Android - Deprecated NDK warnings in Android Studio - android

After a long time working fine my project suddenly build failed. The image below is what i get from log.
I already have gradle.properties file with 'android.useDeprecatedNdk=true' in my project but the error keep show up.
Please help. :(

The warning says that useDeprecatedNdk=true will stop working soon. If you plan to keep using the latest Gradle Plugin, you should edit your build.gradle and use externalNativeBuild.
Actually, the change should be pretty easy, and the explanation on developer.android.com is quite straightforward.
The error you see is probably not related to the warning. Something went wrong in your build. The easiest way to find out is to run same ndk-build in the terminal window of your Android Studio, and analyze the results.
Carefully copy all parameters from the log, and add V=1:
/Users/haulx94/Library/Android/sdk/ndk-bundle/ndk-build NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/haulx94/AndroidProject/hd1-android/HDONE/app/build/intermediates/ndk/stagging/debug/Android.mk APP_PLATFORM=android-25 NDK_OUT=/Users/haulx94/AndroidProject/hd1-android/HDONE/app/build/intermediates/ndk/stagging/debug/obj NDK_LIBS_OUT=/Users/haulx94/AndroidProject/hd1-android/HDONE/app/build/intermediates/ndk/stagging/debug/lib APP_STL=gnustl_shared APP_ABI=armeabi-v7a V=1

Related

Upgrading to Gradle 7.1.1 in Android Studio Breaks Build

After upgrading to Gradle 7.1.1, I get the following build error:
Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
I've done as many Google searches as I could but can't find anything on this. I've tried running the build with stacktrace, debug and scan options but there is nothing in the output window that gives a hint as to where this is coming from, except that it's in this task:
app:mergeProductionDebugResources FAILED
I'm assuming there is some file somewhere that's doing this but I don't know how to begin finding it.
I would like to know if there is some place to look that I'm not aware of, or if there is some procedure to help me track this down.
I found my issue. Someone had added an empty xml file to the project. Previous versions of gradle just ignored this, but 7.1.1 doesn't.

Android studio NDK Gradle build "Source ... and destination ... must be different"

I'm using Android Studio with NDK, Gradle and CMake to build several shared libraries and link them together.
I keep getting the same error again and again in the build log:
:app:processDebugManifest [Passed]
:app:externalNativeBuildDebug [Passed]
Source C:\XXX\app\build\intermediates\cmake\debug\obj\arm64-v8a\libBGS-d.so and destination C:\XXX\app\build\intermediates\cmake\debug\obj\arm64-v8a\libBGS-d.so must be different
It's like gradle is trying to copy my library at the same position.
The thing is, I have no idea where this instruction comes from and how I can debug it. There's really not much indication in the build log.
What's confusing is that is doesn't occur 100% of the time. Seems like there is a race condition somewhere. Also sometimes it's another library that triggers the build to fail. Also, cleaning the project doesn't help.
So here's my question: is there any place where I can get granular control over the Gradle build sequence ?
According to Dan Albert at https://stackoverflow.com/a/62223434/8068814 this appears to be a bug and he suggests cleaning the project, then triggering "refresh linked c++ projects" and then building the project. Since it is sometimes working for you, this might be a reliable solution in your case.
For me this did not help, but reverting the Gradle plugin to 3.6.2 was the only way for me to build my project.

Android Room tutorial does not build

UPDATE: Solved! (see fix at the bottom)
I'm trying to go through the Android Room tutorial but get stuck on step3. I keep getting an error when trying to update the gradle file as specified by the tutorial.
https://codelabs.developers.google.com/codelabs/android-room-with-a-view/index.html?index=..%2F..index#1
When trying to build, I get the following error:
Setting roomVersion to "2.1.0-alpha06" or just "2.1.0" generates the same type of error.
Is it only me or is there something wrong with this tutorial?
Anyone with an idea why the androidx.room:room-testing dependancy fails to build?
UPDATE:
I solved the issue by uninstalling Android Studio and re-installing it. I also needed to do a full cleanup and remove all "android studio" and "gradle" related files on my system. Maybe a bit overkill, but this is whats fixed it for me.

Android Studio Execution failed for task ':app:mergeDebugResources' with special chars in username

i have a strange error with AAPT2 iin Android Studio. I think it has something to do with german special characters in my account name in windows.
If i set my gradle to version 3.0.1 and also set android.enableAapt2 to false everything works fine. But since i researched, setting the option is not a solution to the problem.
Now if i set the gradle version to 3.1.2 and remove android.enableAapt2 from the properties i get the following error message:
And this one:
One way to solve the problem was to create a new account in windows without special chars in the name. It compiled and did run very well. I really tried everything in the web but could not find a solution to the problem.
Maybe you can help me.
First of all check your build log botom of the build section you shared whether any error related to your project showing or not. If error showing then fix those. Build and run again and fix all the error comes up. It will eliminate aapt2 issue without changing android gradle plugin.
Secondly if there is not any project related error showing in the build log but still its showing aapt2 error then you can fix it by following below steps.
Update your android gradle plugin in your project level build.gradle file like below:
classpath 'com.android.tools.build:gradle:3.2.0-alpha13'
Now update android.enableAapt2=true. Then check and build your project.

Errors running builder 'CDT Builder' when trying to build OpenCV for android samples

Hello guys I'm trying to learn about openCV in android
I've already following the instruction given here
but when I'm trying to compile I'm only getting
01:50:14 ** Auto Build of configuration Default for project
org.opencv.samples.fd.FdActivity **
"C:\Android\android-ndk-r8\ndk-build.cmd" Install:
libdetection_based_tracker.so =>
libs/armeabi-v7a/libdetection_based_tracker.so
01:50:14 Build Finished (took 184ms)
in the console
and I'm also get an error
Errors occurred during the build. Errors running builder 'CDT Builder'
on project 'org.opencv.samples.fd.FdActivity'. Internal error building
project org.opencv.samples.fd.FdActivity configuration Default
java.lang.NullPointerException Internal error building project
org.opencv.samples.fd.FdActivity configuration Default
java.lang.NullPointerException
anyone ever encountered this problem before?
please help me to solve this problem
thank you
try
Project Properties>C/C++ Build>Tool Chain Editor
Current toolchain: Android GCC
Current builder: Android Builder
Project Properties>C/C++ Build
(uncheck) use default build command
Build command: ndk-build
(uncheck) generate Makefiles automatically
You may have renamed the project, and the eclipse forgot to rename the "Refresh Policy".
Just update "Project properties -> C/C++ Build -> Refresh Policy" manually solved my problem.
BTW, ADT has some very bad error descriptions as of in this case.
I might have the same problem,
try ndk-build -B which rebuild all the things, see whether you still got error,
if no error remain, there is no problem with your ndk-build. try to run your android apps without CDT installed, if this works, at least we could use comand line to build the c++ part of code.
but CDT is still not working well, after I install the CDT according to the opencv doc, I got lots of errors, add the cygwin and gcc things to the path would solved most of it. But the last things every strange is, I got an error here.
in the face detection sample, .cpp part
catch(cv::Exception e)
{
LOGD("nativeCreateObject catched cv::Exception: %s", e.what());
it always says symbol "e" can not be resolved.
but no error when I include the opencv things.
even when I try to put cv::Exception e outside of the catch()
These works for me:
Build command: ndk-build
(uncheck) generate Makefiles automatically

Categories

Resources