NDK is not configured issue in android studio - android

My Application is built successfully on Eclipse but fails to Build on android studio.
It returns the error code Ndk is not Configured.
Then I've added ndk path to build.gradle then its showing the following error:
Information:Gradle tasks [:nano:assembleDebug]
WARNING [Project: :nano] Current NDK support is deprecated. Alternative will be provided in the future.
:nano:preBuild UP-TO-DATE
:nano:preDebugBuild UP-TO-DATE
:nano:compileDebugNdk
make.exe: *** No rule to make target `C:\Users\admin\nano\nano\build\intermediates\ndk\debug\obj/local/arm64-v8a/objs/la_audio_processing_android/C_\Users\admin\nano\nano\src\main\jni', needed by `C:\Users\admin\nano\nano\build\intermediates\ndk\debug\obj/local/arm64-v8a/objs/la_audio_processing_android/C_\Users\admin\nano\nano\src\main\jni\LA_PostProcessing.o'. Stop.
Error:Execution failed for task ':nano:compileDebugNdk'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\admin\AppData\Local\Android\ndk\ndk-build.cmd'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 3.449 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

This is the problem faced by Android studio users in Windows environment.
First for NDK not Configured problem
Go to local.properties file and give ndk path...
for ex :
#Wed Mar 18 14:10:33 IST 2015
sdk.dir=C\:\\Users\\admin\\AppData\\Local\\Android\\sdk1
ndk.dir=C\:\\Users\\admin\\AppData\\Local\\Android\\ndk
Then for the Next Problem or Error...
Goto JNI Folder and create an empty c file by any name...
Then your problem will be solved...
Some Quick links about this are
http://ph0b.com/android-studio-gradle-and-ndk-integration/
And
https://code.google.com/p/android/issues/detail?id=66937

Go to option File->Project Structure
Select SDK Location->Android NDK Location and choose NDK listed in dropdown

For whatever reason, setting ndk.dir on the properties file is not working for me. However, setting/exporting the variable ANDROID_NDK_HOME prior to launching android studio did the trick.
Bash syntax (paths below are specific to my installation)
export ANDROID_HOME=/opt/android-sdk-linux
export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle
Environment
Ubuntu Linux x64/GNU bash, version 4.4/Android Studio 2.2.3

Goto Files -> Project Structure -> SDK Location
Android NDK Location is at the bottom right of the window.

I use Android Studio 1.4.1.
Below is my local.properties
ndk.dir=C:\Users\BestQ\AppData\Local\Android\Sdk\ndk-bundle
sdk.dir=C:\Users\BestQ\AppData\Local\Android\Sdk
It work well.

In build.gradle use
android {
ndkVersion '21.1.6352462'
}
and use android.useDeprecatedNdk=true in gradle.properties

In some cases, you need to point exact version of ndk version on the local.properties file like that:
ndk.dir=/Users/ali6p/Library/Android/sdk/ndk/21.3.6528147
If you need to install a specific version of ndk bundle, open Android Studio preferences and install the version (Preferences > Appearance & Behaviour > System Settings > Android SDK > SDK Tools: Show Package Details > NDK (Side by side): check the version:

My issue was caused by the target file not being found (in my case, a git sub-module needed to be checked out), so ensure all the referenced files exist on the specified path.

Maybe the NDK is not installed.
If it's the case, go to SDK Manager (top-right icon).
Go to Android SDK > SDK Tools
Check NDK (Side by side) and install it.

Related

The HMS GameServiceDemo compilation fails

Error information: NDK solution Result: Project settings: Gradle model version = 6.1, NDK version UNKNOWN
However, the NDK has been defined in the Project Structure > SDK location > Android NDK location: android \ sdk \ ndk \ 21.0.6113669.
What is the cause of the error?
If the synchronization is normal, the compilation is successful. However, if the synchronization is performed only, the APK file is not packed and generated. In this case, try Build->Build Bundle(s)/APK(s)->Build APK(s). The generated APK file is stored in the project directory\build\outputs\apk\debug directory.
The error message "NDK Resolution Outcome: Project settings: Gradle model version=6.1, NDK version is UNKNOWN" should be displayed in the Event Log, which does not affect the compilation of the project.
If the project fails to be compiled, provide the build error information.
If an error occurs, click Run build in the Build window to display the detailed error information.

Android Studio 3.1.2 Gradle Error : Could not resolve all files for configuration ':lintClassPath'

I am on mac, using android studio 3.1.2 . I have changed the gradle version to 4.4 and Android plugin to 3.1.2
I have already changed the compile keyword to implementation in the build.gradle
I am getting this error :
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':lint'.
> Could not resolve all files for configuration ':lintClassPath'.
> Could not find com.android.tools:sdk-common:26.1.2.
Searched in the following locations:
file:/Users/rp/Library/Android/sdk/extras/m2repository/com/android/tools/sdk-common/26.1.2/sdk-common-26.1.2.pom
file:/Users/rp/Library/Android/sdk/extras/m2repository/com/android/tools/sdk-common/26.1.2/sdk-common-26.1.2.jar
how can this be fixed?
The cause of this issue is that Gradle can't find the Android SDK. There are several ways to fix it:
Define the ANDROID_HOME environment variable
ANDROID_HOME=your/path/to/android/sdk; export ANDROID_HOME
or Add sdk.dir to the file local.properties, for example on my Linux computer
sdk.dir=/home/sdeng/Android/Sdk
if you already defined ANDROID_HOME or sdk.dir, it still happens. It probably something is wrong with the specific version of your Android SDK or Gradle daemon. Try to kill all Gradle processes, re-download the specific version of Android SDK.
Or you can check the SDK at $ANDROID_HOME/platforms/android-28, where 28 is the compileSdkVersion defined in build.gradle
Like other comment says, change to a good SDK version works in this case.

Android Studio how to run gradle sync manually?

I'm debugging Gradle issues in Android Studio and see references to "Run gradle sync", but I'm not sure how to run this command.
How do I run "Gradle sync" from Android studio or Mac terminal?
Android studio should have this button in the toolbar marked "Sync project with Gradle Files"
EDIT: I don't know when it was changed but it now looks like this:
EDIT: This is what it looks like on 3.3.1
OR by going to File -> Sync Project with Gradle Files from the menubar.
WARNING: --recompile-scripts command has been deprecated since gradle's version 5.0.
To check your gradle version, run gradle -v.
./gradlew --recompile-scripts
it will do a sync without building anything.
Alternatively, with command line in your root project
./gradlew build
It will sync and build your app, and take longer than just a Gradle sync
To see all available gradle task, use ./gradlew tasks
In Android Studio 3.3 it is here:
According to the answer https://stackoverflow.com/a/49576954/2914140 in Android Studio 3.1 it is here:
This command is moved to File > Sync Project with Gradle Files.
Keyboard shortcut lovers can add a shortcut for running gradle sync manually by going to File -> Settings -> Keymap -> Plugins -> Android Support -> Sync Project with gradle files (Right click on it to add keyboard shortcut) -> Apply -> OK and you are done. Choose any convenient key as your gradle sync shortcut which doesnot conflict with any other shortcut key, (I have choosen Shift + 5 as my gradle sync key), so next when you want to run gradle sync manually just press this keyboard shortcut key.
I presume it is referring to Tools > Android > "Sync Project with Gradle Files" from the Android Studio main menu.
gradle --recompile-scripts
seems to do a sync without building anything.
you can enable automatic building by
gradle --recompile-scripts --continuous
Please refer the docs for more info:
https://docs.gradle.org/current/userguide/gradle_command_line.html
Shortcut (Ubuntu, Windows):
Ctrl + F5
Will sync the project with Gradle files.
I think ./gradlew tasks is same with Android studio sync. Why? I will explain it.
I meet a problem when I test jacoco coverage report. When I run ./gradlew clean :Test:testDebugUnitTest in command line directly , error appear.
Error opening zip file or JAR manifest missing : build/tmp/expandedArchives/org.jacoco.agent-0.8.2.jar_5bdiis3s7lm1rcnv0gawjjfxc/jacocoagent.jar
However, if I click android studio sync firstly , it runs OK. Because the build/../jacocoagent.jar appear naturally.
I dont know why, maybe there is bug in jacoco plugin. Unit I find running .gradlew tasks makes the jar appear as well. So I can get the same result in gralde script.
Besides, gradle --recompile-scripts does not work for the problem.
I have a trouble may proof gradlew clean is not equal to ADT build clean. And Now I am struggling to get it fixed.
Here is what I got:
I set a configProductID=11111 from my gradle.properties, from my build.gradle, I add
resValue "string", "ProductID", configProductID
If I do a build clean from ADT, the resource R.string.ProductID can be generated. Then I can do bellow command successfully.
gradlew assembleDebug
But, as I am trying to setup build server, I don't want help from ADT IDE, so I need to avoid using ADT build clean. Here comes my problem.
Now I change my resource name from "ProductID" to "myProductID", I do:
gradlew clean
I get error
PS D:\work\wctposdemo> .\gradlew.bat clean
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\work\wctposdemo\app\build.gradle'
* What went wrong:
Could not compile build file 'D:\work\wctposdemo\app\build.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 57
If I try with:
.\gradlew.bat --recompile-scripts
I just get error of
Unknown command-line option '--recompile-scripts'.
Anyone wants to use command line to sync projects with gradle files, please note:
Since Gradle 5.0,
The --recompile-scripts command-line option has been removed.
https://docs.gradle.org/5.0/userguide/upgrading_version_4.html#potential_breaking_changes
https://docs.gradle.org/current/userguide/command_line_interface.html
https://github.com/gradle/gradle/issues/1425
From terminal:
gradle prepareKotlinBuildScriptModel
NOTE: you can see what android studio is doing by inspecting the "Build" tab. There will be difference windows inside there. One should be "Sync"

IDEA reports Error with Android Gradle Build Target

I cannot build the project using Idea, I get following message right after launch:-
Error:Android Gradle Build Target: org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation 'C:\Users\username\.gradle\wrapper\dists\gradle-1.11-bin\4h5v8877arc3jhuqbm3osbr7o7\gradle-1.11'.
content of following directory:
c:\Users\malousek\.gradle\wrapper\dists\gradle-1.11-bin\4h5v8877arc3jhuqbm3osbr7o7\gradle-1.11\
is following:
bin
init.d
lib
media
changelog, license, notice,
IDEA Settings for Gradle:
Use Default Gradle Wrapper (recommended)
Last time I tried Intellij 13 It had many problems with Gradle (1.11+), use Intellij EAP 14 or switch to Android Studio.
You can try removing "C:\Users\username.gradle\wrapper\dists\" directory and resync your gradle project.

Maven Android SDK Deployer run the command "mvn install" error: Properties file not found. The file path seems not correct

[ERROR] Failed to execute goal org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:read-project-properties (default) on project android-17: Properties file not found: D:\maven-android-sdk-deployer-master\platforms\android-17\${env.ANDROID_HOME}\platforms\android-17\source.properties -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:read-project-properties (default) on project android-17: Properties file not found: D:\maven-android-sdk-deployer-master\platforms\android-17\${env.ANDROID_HOME}\platforms\android-17\source.properties
I'm using maven on windows.
ANDROID_HOME has been set. The value is D:\adt-bundle-windows-x86_64\sdk
I could find source.properties under D:\adt-bundle-windows-x86_64\sdk\platforms\android-17
D:\maven-android-sdk-deployer-master\platforms\android-17\${env.ANDROID_HOME}\platforms\android-17\source.properties should be D:\maven-android-sdk-deployer-master\platforms\android-17\D:\adt-bundle-windows-x86_64\sdk\platforms\android-17\platforms\android-17\source.properties. It's not a valid path. I think that's what cause the failure.
Please tell me how to fix the issue. Thanks!
I had this same issue. It can be resolved by opening the Android SDK Manager, removing the item which is producing the error (in your case the Android 4.2.2 API 17 SDK) and then once its removed simply install it again before you run the deployer again.

Categories

Resources