React-native-blob-util couldn't find ANDROID_SDK_ROOT - android

npx react-native run-android causes the following error with module react-native-blob-util on Big Sur/React Native 0.66.1/Android Studio 2020.3.1:
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/macair/Documents/code/js/xyz_app5/node_modules/react-native-blob-util/android/build.gradle' line: 69
* What went wrong:
A problem occurred configuring project ':react-native-blob-util'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/macair/Documents/code/js/xyz_app5/android/local.properties'.
The line of code in react-native-blob-util 0.13.16 build.gradle which causes error is:
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
But a .bash_profile has been created with ANDROID_SDK_ROOT defined. Also in project structure under android studio SDK has been defined and pointing to /Library/android/sdk. What is really missing here?
Here is the SDK defined in project structure:

After installing Android 10 by following setup for Android in React Native, the error disappeared.

Related

Error : Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' while running React Native Project

I have got an error while trying to run my React Native project.
react-native run-android
Error looks like
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'E:\IT tasks\android\ninja-react-native\android\local.properties'.
Please help me.
Add SDK(sdk.dir) location path in local.properties file:
For windows users:
sdk.dir = C:\\Users"MyUserName"\\AppData\\Local\\Android\\Sdk
For Mac users:
sdk.dir = /Users/USERNAME/Library/Android/sdk
For Linux users:
sdk.dir = /home/USERNAME/Android/Sdk
Replace Username with your's users Name. And check that sdk forlder name is Sdk or sdk, replace with it.

Unable to create build ionic3 using command ionic build android

I set an environment path for JAVA_HOME and followed
android studio Error:Unable to start the daemon process.
I'm still getting an error, not able to create build. I am using latest version of node, npm, ionic.
Error:
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_11
studio
Subproject Path: CordovaLib
Subproject Path: app
[12:02:18] lint finished in 9.73 s
[Fatal Error] gradle-bintray-plugin-1.7.3.pom:2:1: Content is not allowed
log.
[Fatal Error] android-maven-gradle-plugin-1.5.pom:2:1: Content is not all
prolog.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> Could not resolve all files for configuration ':CordovaLib:classpath'.
Did you upgrade your cordova? After updating it might be run. Or you can remove nodemodule folder and then do npm install and then try to build your app.

Ionic 3 BUILD FAILED with Cordova: cordova\node_modules\cordova-common\src\superspawn.js:169:23

In Ionic 3 with Cordova when I give the command:
ionic cordova run android --device
i have already installed and set the path in system environment
JDK
SDK
Node js
I have researched a lot on the internet and I can not solve it. What can I be doing wrong?
Even formatting the computer already formatted. I do not know what to do. Neither messages from other forums with the "supposed" same error, did not work out.
It gives me the following errors:
`E:\NAB\ionic\new\myApp>ionic cordova run android
Running app-scripts build: --platform android --target cordova
[12:54:42] build dev started ...
[12:54:43] clean started ...
[12:54:43] clean finished in 16 ms
[12:54:43] copy started ...
[12:54:44] deeplinks started ...
[12:54:44] deeplinks finished in 203 ms
[12:54:44] transpile started ...
[12:54:58] transpile finished in 14.50 s
[12:54:58] preprocess started ...
[12:54:58] preprocess finished in less than 1 ms
[12:54:59] webpack started ...
[12:54:59] copy finished in 15.94 s
[12:55:32] webpack finished in 33.82 s
[12:55:32] sass started ...
[12:55:38] sass finished in 5.26 s
[12:55:38] postprocess started ...
[12:55:38] postprocess finished in 78 ms
[12:55:38] lint started ...
[12:55:38] build dev finished in 55.31 s
> cordova run android
Android Studio project detected
ANDROID_HOME=C:\Users\Sohail Akbar\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_171
studio
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not find gradle-core.jar (com.android.tools.build:gradle-core:3.0.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle-core/3.0.0/g
radle-core-3.0.0.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
[12:55:47] lint finished in 9.31 s
(node:2132) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with ex
it code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not find gradle-core.jar (com.android.tools.build:gradle-core:3.0.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle-core/3.0.0/g
radle-core-3.0.0.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
at ChildProcess.whenDone (E:\NAB\ionic\new\myApp\platforms\android\cordova\n
ode_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:2132) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
error originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). (rejection
id: 1)
(node:2132) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre
cated. In the future, promise rejections that are not handled will terminate the
Node.js process with a non-zero exit code.`
thanks in advance
Sorry for my bad English, I will try my best to present the answer in easy way.
I just spend my two days and nights on solving the same issue and finally I found one.
The main problem is with the Android-NDK.
Ionic framework is looking for mips64el-linux-android package in the ndk-bundle folder of Android SDK.
If You visit Your Android-SDK folder, You will find a folder with name ndk-bundle, inside this open the folder name toolchains You will see that toolchains doesn't contains the package mips64el-linux-android.
You have to download it manually.
You can download the latest version of Android-NDK here, but unfortunately this latest version doesn't contain the package we need.
At the bottom of this page You will find a link to download the older versions of Android-NDK, follow that link and download Android NDK, Revision 14b (March 2017). That's the NDK version Ionic looking for.
Now go to Your Android-SDK path, then NDK-Bundle and delete everything from that folder. And extract the downloaded file in NDK-Bundle folder, You will see the package mips64el-linux-android.
Everything is good to go now.
Hope so it will work.
Below is a summation of my experience installing cordova on ionic-4. See in particular the section on mips64el-linux-android error. Just follow along and create the dummy folder and subfolders as explained.
Cordova expects to see the path to C:\Users\myusernamehere\AppData\Local\Android\Sdk\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\bin\mips64el-linux-android-strip but does not require it (in my case) and will throw an error if absent.
Ionic Cordova Installation experience.
• Re- install Java JDK 8 to the latest update.
• Add ANDROID_SDK_ROOT variable to point to existing installation of Android Studio SDK
• Add Java JDK\bin to the environment PATH variable on user and system
• Download Gradle 5.2 and create folder C:\Gradle and extract the contents inside. Your
The path should look like this
C:\Gradle\gradle-5.2\bin\gradle.bat
Add "C:\Gradle\gradle-5.2\bin" to PATH variable on System
From the command line do the following ..
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
• Using a previously installed edition of Android Studio go to Tools => SDK Tools
And check the NDK checkbox for download, click apply and ok.
• In the project terminal - Enter
ionic cordova prepare android
to build Cordova.
If there are errors delete the platforms\android project directory and rebuild.
If there is a Gradle error looking for NDK "mips64el-linux-android-version"
Do the following ..
• Open the NDK bundle\toolchains folder within Android SDK eg C:\Users\Shay\AppData\Local\Android\sdk\ndk-bundle\toolchains
• And using command line create a folder "mips64el-linux-android-4.9" ( same version number (4.9) as other folders) inside create folder "prebuilt" .. then folder "windows-x86_64" and inside place and empty text file for contents.
The created path should look like .. "C:\Users\Shay\AppData\Local\Android\sdk\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\dummy file" is not required by Cordova but is expected to be in its path .. otherwise it will throw an error and fail to build.
Alternatively, download an older build such as https://developer.android.com/ndk/downloads/older_releases/android-ndk-r16b-windows-x86_64.zip and extract the required folder to the new ndk folder in the same location as above.
• Finally, once again enter
ionic cordova prepare android
to build Cordova
The Ionic build order (as I observed it) is a follows ..
1. It looks for all the relevant Java and Android SDK paths ..
2. Then uses Gradle as the build system ..
3. Check for NDK bundle ..
4. Build project
The above took me two days to figure out. Hope it helps and saves you the headache.

React-Native Setup: Could not normalize path for this file

I am just beginning my work with React-Native. After initializing the directory for my project and starting react in one terminal, I use the command react-native run-android to start the emulator. The emulator fails with the error:
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\dannyd1221\Desktop\School\CIS350\Weekdays\android\app\build.gradle' line: 110
What went wrong:
A problem occurred evaluating project ':app'.
Could not normalize path for file 'C:\Users\dannyd1221\Desktop\School\CIS350\Weekdays\android\C:Usersdannyd1221AppDataLocalAndroidSdk\tools\proguard\proguard-android.txt'.
Clearly the path to proguard-android.txt is incorrect, but I'm not sure where that path is being set. Any ideas as to how this can be fixed?
Had a similar error.
Worked when i Replaced
C:\Users\dannyd1221\Desktop\School\CIS350\Weekdays\android\
with
C:/Users/dannyd1221/Desktop/School/CIS350/Weekdays/android/

Android Studio multi-dex gradle doesn't recognize java on mac

I'm trying to compile a gradle project (plugin 0.14.0) with multi-dex on my Mac, and getting this error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ApplicationContainer:createDebugMainDexClassList'.
> java.io.IOException: Cannot run program "java": error=2, No such file or directory
Any suggestions?
When I execute ./gradlew from terminal, it works.
Found a solution.
Seems like Android Studio didn't inherit environment path or something.
I ran it from the terminal:
open /Applications/Android\ Studio.app
And it solved it.
More elegant solutions will be happily accepted :D

Categories

Resources