I have a simple react-native project when I try to build an android release version of the application, I face this error message:
Caused by: java.lang.RuntimeException:
org.gradle.api.InvalidUserDataException: NDK not configured. Download
it with SDK manager. Preferred NDK version is '21.4.7075529'
I made a Keystore and set password like android studio to get a release and debug apk.
I tried this until now:
I tried to set NDK in android studio but couldn't build the project.
I also modified build.gradle to build the project but was unsuccessful.
I put my singingConfig and buildTypes and also stackTrace below.
my keystore data
singingConfig and buildTypes
What went wrong:
A problem occurred evaluating project ':expo'.
A problem occurred configuring project ':expo-modules-core'.
Failed to notify project evaluation listener.
> org.gradle.api.InvalidUserDataException: NDK not configured. Download it with SDK manager. Preferred NDK version is '21.4.7075529'.
> Could not get unknown property 'release' for SoftwareComponentInternal set of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.
Open root folder projectname > android > open local.properties > copy and paste below lines after sdk.dir (if you don't have a local.properties file copy the below file and change SDK path according to your operating system.)
sdk.dir=/Users/yourusername/Library/Android/sdk
ndk.dir=/Users/yourusername/Library/Android/sdk/ndk/21.4.7075529 (You should find this version in the NDK folder and the path will vary depending on your operating system.);
I solved this problem using another way to get release version of the apk.
I used eas build -p android or expo build:android and finally after a really long time expo generates apk on his website. But it was too large application about 60mg and I'm trying to reduce it's size.
eas build -p android this command is for abb version
expo build:android this is for apk release.
but unfortunately, I Couldn't use gradle in order to release apk.
Related
I am working on an Android native project which builds using CMake.
In my build.gradle I specify :
if(project.hasProperty("native")) {
externalNativeBuild {
cmake {
path file('jni/CMakeLists.txt')
version '3.18.1+'
}
}
}
I want to invoke externalNativeBuild task from command-line only on an automated build server.
However I am getting this error:
CMake '3.18.1' or higher was not found in SDK, PATH, or by cmake.dir property.
When I build it inside Android Studio normally, It downloads and install CMake but it is not happening from command-line.
Is there a way to do it from command-line?
Android studio will automatically create a local.properties file which contains the cmake.dir property.
When you build on the build server, it's more than likely that you your source doesn't have a local.properties file as that file is not normally checked into code repositories. You'll either need to create this file or modify the PATH environment variable to include the cmake binary. This of course presumes that you have CMake installed on the build server. You can do this manually with a .zip/.tarball or if you have access to the SDK on the build server, you can install with the build tools -> How to install Android SDK Build Tools on the command line?
I used the VCS option to import a harmonyOs project from gitee to my Dev Eco Studio and the build failed due to the above errors , please help me resolve it
Gitee(link of the repo which i was trying to open):
https://gitee.com/openharmony-tpc/EasyPrefs
Using the Project from Version Control in File ->New to import the project at the link https://gitee.com/openharmony-tpc/EasyPrefs in DevEco Studio Release 2.1 Build Version 2.1.0.501, or downloading the project and opening it in the DevEco Studio release version, I can successfully sync the project with Gradle files and build the debug Hap as shown in the screenshot below.
You need to add the “installationFree”: false in the config.json file as shown below.
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.
I have tried the Crystax sample on IDEA, and I have compiled it successfully, got it to run on my phone.
However, when I try to modify the project, IDEA throws an error about Gradle version:
Error:The project is using an incompatible version of the Android Gradle "experimental" plugin.
Please update your project to use version 0.9.0.
Then I updated it and met new problems:
Gradle version 3.3 is required. Current version is 4.1.
Please fix the project's Gradle settings.
I choose to Fix Gradle wrapper and re-import project
Then the next error appears:
Cannot set readonly property: proguardFiles for class: com.android.build.gradle.managed.BuildType
Please, is there anyone who knows how to use Crystax on IDEA IDE?
I found an alternative way, which does not relies on AS to build.
Just set your system PATH to Crystax-ndk folder, set up your Application.mk and Android.mk, and run command:
ndk-build
then you will get the result lib or executable file, then, link it to your Android project.
I want to export apk file "release apk" from command line
when I run this command : gradlew installRelease
and I found this
Android Studio Task 'install Release' not found in root project ''.
Some candidates are: 'uninstall Release'.
How can I solve it?
My experience has been that the installRelease task does not become available until you define the signingConfigs in the buildTypes.release block of your build file, as shown in step 3 of Signing in Release Mode. Without signingConfigs, you will get other release tasks, such as assembleRelease, but not installRelease.
So there is no such task. You can see all available tasks calling gradlew tasks. To assemble release version of apk call gradlew assembleRelease and then using adb install it.
You may build with Android Studio Build/Generate Signed APK.... In this case you'll get .apk file in your repository. You then can use adb install .apk to install it. You'll have no changes in build.gradle file in this case.
Alternatively you may change build.gradle file as mentioned here. In this case you will have installRelease task. You may get these changes in build.gradle using Open Module Settings menu. See details in Gradle for Android and Java course from Udacity.
In my case, the installRelease option didn't show up until I deleted the line
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {