17

After upgrading gradle of my project (and library attached to it) from 2.1.3 -> 2.2.0 it doesn't build anymore and it says:

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

Anyone have a clue on why this is?

Tomek
  • 557
  • 2
  • 7
  • 24
  • https://code.google.com/p/android/issues/detail?id=223162 cleaning might help – laalto Sep 21 '16 at 11:47
  • Thank you, will try that, didn't find this issue listed there – Tomek Sep 21 '16 at 11:52
  • Happened to me after downgrading SDK target from 24 to 23 – Antzi Sep 27 '16 at 08:10
  • Cleaning didn't work :/ I cannot remove NDK from my project. I didn't change that setting, I have target SDK on 22. When I revert Gradle back it works but not if I update it. The problem has to be something with C++ libraries (I think), because Android studio asked on the update something about C++ libraries added(or you couldn't build project) – Tomek Sep 27 '16 at 10:59
  • Possible duplicate of [Error:Execution failed for task ':hello\_motion\_tracking:transformNative\_libsWithStripDebugSymbolForDebug'. >](https://stackoverflow.com/questions/39761895/errorexecution-failed-for-task-hello-motion-trackingtransformnative-libswith) – Aaron Brager May 15 '18 at 13:57

4 Answers4

14

I found answer here: https://stackoverflow.com/a/40117446/1088975

The point is to set both targetSdkVersion and compileSdkVersion to 22"

Community
  • 1
  • 1
Tomek
  • 557
  • 2
  • 7
  • 24
  • Mine is set to the correct version for all build.gradle files, project structure and flavors for my libGDX project. No juice. – person27 Oct 31 '17 at 06:24
3

You need to change the following lines in build.gradle file:

    android {
        // SDK 24 worked for me - make sure you have the latest and update it accordingly.
        compileSdkVersion 24
        buildToolsVersion "24.0.2"
    ...
    }
Asaf Pinhassi
  • 15,177
  • 12
  • 106
  • 130
  • I have compileSdkVersion on 16 because I need to have it. I changed from 22 build tools to your 24.0.2 but it didn't work :/ same issue – Tomek Sep 29 '16 at 14:04
0

Maybe you can update the ndk version. I update the ndk version from r10 to r13,and finally it worked.

hying
  • 11
0

You might want to check if the location of your NDK folder has any white space in it...if it has you can move your ndk folder to the c:\ drive and rebuild

Also, check the gradle versiom of your app and either upgrade or download later version, because some ndk versions do not support later gradle version

X-Black...
  • 1,376
  • 2
  • 20
  • 28