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

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/

Related

Flutter Fastlane Gitlab Build

I am new to Fastlane and want to build my apk through the Fastlane and Gitlab. I have been getting this error whenever I run the Fastlane command:
FAILURE: Build failed with an exception.
* Where:
Build file '/builds/sw/pro/pro_app_flutter/android/app/build.gradle' line: 30
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not read script '/Users/your-user/Library/Android/flutter/packages/flutter_tools/gradle/flutter.gradle' as it does not exist.
But I am unable to figure this out, what does this mean because flutter.gradle does exist on the path!
Moreover the build from Android Studio is successfully generated!
Thanks in advance
P.S my fast file:
default_platform(:android)
platform :android do
desc "Build a Flutter apk1"
lane :buildDebug do
gradle(task: "assemble", project_dir: 'android/')
end
end

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

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.

Failed to find target with hash string 'android-25' in: /home/hisham/Android/Sdk

Been trying to debug this issue for hours! Tried many solutions online, none seems to be working.
Build properties not found for package Android SDK Platform 25
File /root/.android/repositories.cfg could not be loaded.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
>
Failed to find target with hash string 'android-25' in: /home/hisham/Android/Sdk
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 39.749 secs
Error: /home/hisham/Desktop/Dev-PGDoc/ionic_app/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Failed to find target with hash string 'android-25' in: /home/hisham/Android/Sdk
How do I fix this?
Finally got it fixed! Not sure which one of the following fixed it though.
Change $ANDROID_HOME inside ~/.bashrc from ANDROID_HOME=$HOME/Android/Sdk to ANDROID_HOME=$HOME/Android/Sdk/platform-tools
Deleted version 25's folder inside platform-tools folder in the Sdk and installed version 25 again.
After doing the two above, restarted the system and I am now able to compile and build ionic app to .apk files.
PS : This might be just only in my personal computer, and you might be facing the same issue due to different issue. Hope this helps.

react native run android in emulator throws erro

i install react native and open a new project.
i try to run
react-native run-android
and I get this error
PS E:\Projects\React native\myapp> react-native run-android
Scanning 574 folders for symlinks in E:\Projects\React native\myapp\node_modules (27ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
FAILURE: Build failed with an exception.
* Where:
Build file 'E:\⌠°σΘΘ≈ΦΘφ\⌠°σΘΘ≈ΦΘφ ≈Θ⌡\React native\myapp\android\app\build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Your project path contains non-ASCII characters. This will most likely cause the build to fail on Windows. Please move your project to a different directory. See http://b.android.com/95744 for details. This warning can be disabled by adding the line 'android.overridePathCheck=true' to gradle.properties file in the project directory.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.877 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
As you can see from the error you need to move your project to a different directory with no non-ASCII characters.
Your project path contains non-ASCII characters. This will most
likely cause the build to fail on Windows. Please move your project
to a different directory. See http://b.android.com/95744 for details

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