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!
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!
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.
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...
Related
How can I change a project's name in Eclipse?
Soong is a build system specifically for Android Platform development, and not Android app development, even though the Android Platform can contain regular Android apps built for the system image. That means Soong is not supported to use outside of Android Platform builds.
Your best bet here is to import/copy DeskClock's source code into Android Studio and write your own build.gradle files manually.
I have a Java Android project that includes JNI code written in C.
I often need to debug into the native code and before upgrading Android Studio to version 3.3 it was working.
Now in my project view I don't have any code in my cpp folder. I have confirmed that all of the C libraries are in the folder on my HDD. The CMAKE file is also missing from the project view but is also in the correct place on my HDD.
I have not changed any code from my source control since upgrading.
I am using
'com.android.tools.build:gradle:3.3.0'.
In the Build Variants section next to my JNI module I just have five dashes instead of the debug/production options.
I have uninstalled and reinstalled android studio too.
Is it possible after upgrading I need to add something to my configuration to correct including CMAKE?
I had the same issue, just figured it out. In AndroidStudio 3.3.1, they changed things around a bit I guess. Now you have to link your NDK build to the app you are building it as part of.
This is documented at: https://developer.android.com/studio/projects/gradle-external-native-builds
The section, "Use the Android Studio UI" is what you want.
I tried to import multiple android projects with render scripts, but often it does not make me compile with the "Project SDK is not defined" warning.
How should I do? Do I have to include some words?
I was interested in this project:
https://android.googlesource.com/platform/frameworks/rs/+/master/tests/java_api/LivePreview/
Use Android Studio 2.3.3
Those sources are part of the platform build, not a normal app build used by Android Studio (or even Eclipse.) In order to build it in Android Studio, you would need to manually setup your own project structure and pull the code into the correct place. Sources need to follow the Android Studio / gradle layout (app/src/main/java/... for Java sources, app/src/main/rs for Renderscript sources, etc.)
The SDK location is typically stored in the local.properties file at the top level of your project tree and is developer specific (not committed to rev control.)
First step: I use QtCreator to compile a bunch of libraries (.so files) + a GUI test program to test those libraries on an Android device.
Second step: After I tested them, I re-compile the libraries without the GUI test program and send them to a client who's going to integrate those .so file in its own Andoid application (generating and apk), not using QtCreator anymore. I do this step using QtCreator (because it's setup, very easy for me to just remove the GUI test program and hit compile), but I'm pretty sure they could also be compiled directly using ndk-build if I work on writting the correct make files for that.
When I re-compile the libraries, there's still a "Android build SDK" option under "Build Android APK" set to "android-22" in QtCreator. However, my client generates its final app for "android-19". And we are wondering if this could be a problem.
My understanding is that my .so files generated in "second step" are built using the NDK only (SDK is not used, so android API version "android-22" is irrelevant as I do not generate any APK...). So there should be no compatibility issue when those .so files are integrated in an application, as far as the same NDK version is used.
Am I right?
I have a main Android project which references 4 other Android-Library projects in gradle. It compiles just fine and i can deploy it via gradle commandline, however I would like to debug my code using eclipse.
Whenever I load up the projects in Eclipse using the gradle integration plugin for Eclipse, eclipse won't even recognize them as library projects and instead treats them like normal android applications. Is this behavior normal or is something wrong with my gradle build script or does eclipse simply not support such a setup yet? Running/debugging the main application in eclipse just installs the individual libraries as regular applications which results in my main application not being able to find the specified classes.
My gradle build script is basically a c&p from Mike Gouline's sample project https://github.com/mgouline/android-samples with "apply: android" replaced with "apply: android-library" for my library projects.
Eclipse doesn't properly support Android Gradle projects. The Android plugin has a lot of specialized support for android-library modules that Eclipse's Gradle integration doesn't know about. For the time being, if you want full IDE support for Android/Gradle, Android Studio or IntelliJ with the Android plugin are your only choices.
We know the situation for people who are using the Gradle build system and want to use Eclipse isn't great; it's something we're thinking about, but we don't have anything definite on the roadmap yet.