Wan Ammar
Wan Ammar

Reputation: 23

APK generated by android studio can be installed in microC board but can't run

Good day to fellow developer out there. Regarding the above title, I have made an application through android studio The application can run in the android studio emulator but cannot be run when installed in the microC

This is the build.gradle for the app:

plugins {
    id 'com.android.application'
//    id 'org.jetbrains.kotlin.android'
    id 'maven-publish'
}

android {
    namespace 'com.example.nfcnpn532'
    compileSdk 33

    defaultConfig {
        applicationId "com.example.nfcpn532"
        minSdk 28
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            // Optionally enable minification for debug builds to test R8 optimizations
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
/*    kotlinOptions {
        jvmTarget = '1.8'
    }*/
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion '1.3.2'
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
    sourceSets {
        main{
            jniLibs.srcDirs = ['src/main/jniLibs'] // Point to the jniLibs folder
        }
    }
    defaultConfig {
        externalNativeBuild {
            cmake {
                cppFlags ""
            }
        }
        ndk {
            abiFilters "armeabi-v7a", "arm64-v8a", "x86_64", "x86"
        }
    }

    externalNativeBuild {
        cmake {
            path "src/main/cpp/CMakeLists.txt"
        }
    }
    externalNativeBuild {
        cmake {
            version "3.30.5"
        }
    }
    ndkVersion '25.1.8937393'
}

dependencies {
    implementation "androidx.annotation:annotation:1.6.0"
    testImplementation 'junit:junit:4.13.2'
    testImplementation 'org.mockito:mockito-core:1.10.19'
    androidTestImplementation 'androidx.test:core:1.5.0'
    androidTestImplementation 'androidx.test:runner:1.5.2'
    androidTestImplementation 'commons-net:commons-net:3.8.0'
    androidTestImplementation 'org.apache.commons:commons-lang3:3.11'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.github.mik3y:usb-serial-for-android:3.5.1'
    implementation 'androidx.core:core:1.10.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation "androidx.compose.ui:ui:1.4.3"
    implementation "androidx.compose.material3:material3:1.1.1"
    implementation "androidx.compose.foundation:foundation:1.4.3"
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'com.google.errorprone:error_prone_annotations:2.3.4'
    // Error-prone annotations for compile-time
    compileOnly 'com.google.errorprone:error_prone_annotations:2.3.4'
    // javax.annotation library
    compileOnly 'javax.annotation:javax.annotation-api:1.3.2'

    constraints {
        implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0") {
            because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib")
        }
        implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0") {
            because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib")
        }
    }
}

and this is the build.gradle for the project:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        //   jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.2'
        //  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30"
        classpath 'com.android.tools.build:gradle:8.0.2'
        classpath 'com.github.dcendents:android-maven-plugin:1.2'
        // classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
    }
}

In android studio emulator, the application build can be activated. but when it is installed in the microC uses Android 9, the application cannot be activated. But, it is installed succesfully. why?

by running the adb logcat, I can identify that 'WindowManager: unable to start animation, surface is null or no children'

how can I correct this?

Upvotes: 0

Views: 42

Answers (0)

Related Questions