Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio 2.2 Native Development Migration Issue

Before making the switch to AS 2.2, I have the following structure to implement my C

app/src/main/jni/Android.mk
app/src/main/jni/Application.mk
app/src/main/jni/headers/*
app/src/main/jni/cfiles*.cc

in which case everything built fine. However, after upgrading to AS 2.2, I cannot build any apk and always recieve the following error:

Execution failed for task':app:transformNative_libsWithStripDebugSymbolForDebug java.lang.NullPointerException (no error message)

Does anyone know why this is? I cannot seem to find a work around.

like image 356
9301293 Avatar asked Sep 20 '16 22:09

9301293


People also ask

Is NDK necessary for Android Studio?

You do not need this component if you only plan to use ndk-build. LLDB: the debugger Android Studio uses to debug native code.


2 Answers

I solved this problem in my project ) try to add this into your build.gradle (module)

    externalNativeBuild {
    ndkBuild {
        path 'src/main/jni/Application.mk'
    }
}

Link Gradle to your native library

like image 138
Matthew Bondarchuk Avatar answered Nov 18 '22 08:11

Matthew Bondarchuk


I upgraded to AS 2.2 this morning and had the same error. Upgrading the NDK solved it for me. You can upgrade via SDK Manager now, instructions are here:

https://developer.android.com/studio/projects/add-native-code.html#download-ndk

Also make sure that your "local.properties" file is pointing to the right NDK location. Example Windows local.properties:

ndk.dir=C\:\\Users\\Me\\AppData\\Local\\Android\\sdk\\ndk-bundle
sdk.dir=C\:\\Users\\Me\\AppData\\Local\\Android\\sdk
like image 38
Greg T Avatar answered Nov 18 '22 07:11

Greg T