7

We have a multi-platform project, with native support, that we are developing in Android Studio using libgdx. We have builds working for Desktop, IOS, Android, Android Wear, and HTML5.

On each of these platforms, we have a different "native" plugin that we are using: a static .a native library on IOS, a .dll on Windows, a bunch of .so files in Android, and a Javascript library on HTML5. All of these, except for the HTML5 version, are built on separate platforms so can't possibly be built by the same Android Studio NDK build.

The problem is that for each of the .java files that declare JNI routines, Android Studio 1.4.x wants to find the source files, but those source files can't possibly be compiled in the IOS project, and likewise for the PC project when running on a Mac.

The standard solution on SO is to add

sourceSets {
    main {
        jni.srcDirs = [] //disable automatic ndk-build
    }
}

To the android{} section, but this ONLY works for the Android, Android Wear launcher projects, and NOT Desktop, IOS, HTML5, etc.

I just want Android Studio to give up on trying to compile NDK, because it can't possibly be done on non-Android projects. Other than finding a downgrade somewhere, how do I do that?

Thanks!

3 Answers 3

6

So, I decided that I could figure this out - and I did!

Of course, the NDK builder is just a plugin in IntelliJ, so all you have to do to disable it is to

  • go to your AndroidStudio installation,
  • find the "plugins" directory
  • move or delete the "android-ndk" folder

Tada! No more NDK plugin!

0
2

Correct way is to uninstall NDK using SDK manager. go to Android Studio-> Tools -> SDK Manager

Under SDK tools tab uncheck "NDK", "CMake", "LLDB" and then apply changes. NDK components will be removed. Downside is NDK is removed for all project. Still struggling to find a way to disable NDK for a particular project only.

1
  • I was finally able to delete it! It is worth noting that you might need to uncheck the 'Hide Obsolete Packages' box in order to see it.
    – Seven
    Commented Apr 30, 2021 at 18:41
-2

If you would like to keep the NDK build for future use and not use it for specific projects just make sure to uncheck these options in the new project dialog...

Link to screenshot

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.