I am running React-Native 0.63.4 and encountering the following error:
Execution failed for task ':app:generateDebugBuildConfig'.
> Failed to calculate the value of task ':app:generateDebugBuildConfig' property 'buildConfigPackageName'.
> Failed to query the value of property 'packageName'.
> java.lang.NumberFormatException: For input string: "1.0.0"
This occurs when running npm run android, shortly after Gradle is done configuring the app and tries to execute it.
This error occurs both when I run the command from the root folder of the project as well as from the /android/ subfolder.
I did a gradlew clean but it is not helping.
Edit:
If I go in my /android/ folder and run gradlew android, the build will complete without error.
It is only when I run npm run android that this error shows up.
Here's another solution:
It's possible the xmls:tools is missing from android/app/src/main/AndroidManifest.xml folder. So you'll need to add that back.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.<buildname>">
This should be the first line at the top of your Manifest.xml.
I finally figured it out.
on the file: android/app/src/main/AndroidManifest.xml
The content began by:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.MyBusiness.MyApp"
android:versionCode="1.0.0"
android:versionName="1.0.0">
The versionCode has to be an integer: Only digits allowed. Apparently it does not matter what it is as it will increment whatever number we put.
Changing this to a number solved my problem:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.MyBusiness.MyApp"
android:versionCode="1000"
android:versionName="1.0.0">
Related
React native application. Despite having entered in the manifest android:exported="true" i still have this problem in the build phase. It almost seems that some installed plugins did not insert it.
I read in some posts that proposed as a temporary solution to downgrade to version 30 of the android SDK, but i cannot because with that version it does not allow me to compile.
React Native 0.68
Android SDK version 33
Android Gradle Plugin version 7.3.0
From Merged Manifest
Error: android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. mobile_app.app debug manifest, line 26 Error: android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. mobile_app.app debug manifest, line 33
Based on the response from Aleja Duque-Torres, here's a temporary solution by adding the following code segment to your AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="...your package name"
xmlns:tools="http://schemas.android.com/tools"> <!-- ADD THIS LINE -->
<!-- Other Content -->
<application
.../>
<!-- ADD STARTS HERE -->
<activity
android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity"
android:exported="false"
tools:replace="android:exported"/>
<activity
android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity"
android:exported="false"
tools:replace="android:exported"/>
<activity
android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity"
android:exported="false"
tools:replace="android:exported"/>
<!-- ADD ENDS HERE -->
</application>
</manifest>
Then do a build folder clean and run the project again. Hope this helps!
P.s. my guess is that this problem is due to some dependency package getting messed up. If someone else has any insight please feel free to shed some light on it!
solution:
In Git-bash run: * ./gradlew assembleDebug --stacktrace --info | tee my-logs.txt
Search "InstrumentationActivityInvoker"
Open file and add android:exported="true" on activity
Same issue, But I can't know the reason for it. It happens when I have updated macos, Do you have any information?
I am trying to build my application at Expo but I have the following problem:
Error Expo
When looking at the build error log, I have the following message:
Using manifest: {"ios":{"supportsTablet":true,"userInterfaceStyle":"light"},"web":{"favicon":"./assets/favicon.png"},"icon":"./assets/icon.png","name":"Porta do Sol","slug":"portaDoSol","splash":{"image":"./assets/splash.png","imageUrl":"https://d1wp6m56sqw74a.cloudfront.net/~assets/761e4c800ce1de9fd90da12f45687087","resizeMode":"contain","backgroundColor":"#ffffff"},"android":{"package":"com.interface.portadosol","userInterfaceStyle":"light"},"iconUrl":"https://d1wp6m56sqw74a.cloudfront.net/~assets/5aab62d1ae6a0f65e10f12c0e55d20dd","locales":{},"updates":{"fallbackToCacheTimeout":0},"version":"0.0.1","platforms":["ios","android","web"],"entryPoint":"./index.js","sdkVersion":"38.0.0","orientation":"portrait","dependencies":["#react-native-community/masked-view","#react-navigation/drawer","#react-navigation/native","#react-navigation/stack","expo","expo-splash-screen","expo-sqlite","expo-status-bar","expo-updates","native-base","react","react-dom","react-native","react-native-appearance","react-native-gesture-handler","react-native-reanimated","react-native-safe-area-context","react-native-screens","react-native-svg","react-native-svg-charts","react-native-web","sqlite"],"bundledAssets":["asset_3a2ba31570920eeb9b1d217cabe58315.ttf","asset_8b12b3e16d591abc926165fa8f760e3b.json","asset_744ce60078c17d86006dd0edabcd59a7.ttf","asset_461d9bba8b6a3c91675039df12cfe6ca.json","asset_140c53a7643ea949007aa9a282153849.ttf","asset_94c4ffdcbffeb0570c635d7f8edd8a25.json","asset_ca9ce9ff0676a9b04ef0f8a3ad17dd08.ttf","asset_54a5c98d22f313098b3dbe2d5b2e87ba.json","asset_b49ae8ab2dbccb02c4d11caaacf09eab.ttf","asset_39843e5d52a6c5c42d5abdb0b34bcaa6.json","asset_b06871f281fee6b241d60582ae9369b9.ttf","asset_f1f91feb805137c9283fb766620ec5eb.json","asset_09dd345dbd4ec5a0874841d5749ac153.json","asset_0886a6b127c6057cee83f9c65c7ffd62.json","asset_f6c6f6c8cb7784254ad00056f6fbd74e.ttf","asset_b70cea0339374107969eb53e5b1f603f.ttf","asset_c39278f7abfc798a241551194f55e29f.ttf","asset_e20945d7c929279ef7a6f1db184a4470.ttf","asset_60668d999bbaf663420340f7bdd580d7.json","asset_b2e0fc821c6886fb3940f85a3320003e.ttf","asset_3e6805fbc794680014716b8c752f20b8.json","asset_3c851d60ad5ef3f2fe43ebd263490d78.ttf","asset_1a0e3525dd5df87e77057204129a5e6e.json","asset_a37b0c01c0baf1888ca812cc0508f6e2.ttf","asset_7e078700f0c35367a56c5bbb2047dda7.json","asset_8e7f807ef943bff1f6d3c2c6e0f3769e.ttf","asset_fdc01171a7a7ea76b187afcd162dee7d.json","asset_d2285965fe34b05465047401b8595dd0.ttf","asset_647543ebfccf6e5495434383598453d1.json","asset_5cdf883b18a5651a29a4d1ef276d2457.ttf","asset_74d124a3caeac2bea111f3ca2f2dd34a.json","asset_7d40544b395c5949f4646f5e150fe020.png","asset_cdd04e13d4ec83ff0cd13ec8dabdc341.png","asset_a132ecc4ba5c1517ff83c0fb321bc7fc.png","asset_0ea69b5077e7c4696db85dbcba75b0e1.png","asset_f5b790e2ac193b3d41015edb3551f9b8.png","asset_5223c8d9b0d08b82a5670fb5f71faf78.png","asset_fd0192cf977ddf7b60b4e21e332f6b76.json","asset_15e61754d2d3825004eed075f496ae28.png","asset_778ffc9fe8773a878e9c30a6304784de.png","asset_376d6a4c7f622917c39feb23671ef71d.png","asset_c79c3606a1cf168006ad3979763c7e0c.png","asset_02bc1fa7c0313217bde2d65ccbff40c9.png","asset_35ba0eaec5a4f5ed12ca16fabeae451d.png"],"id":"#matheusms21/portaDoSol","releaseId":"c05eb142-056f-40e6-a330-79bd258d0e14","revisionId":"0.0.1-r.OkgIqpx_B","publishedTime":"2020-10-04T03:29:57.730Z","commitTime":"2020-10-04T03:29:57.793Z","bundleUrl":"https://d1wp6m56sqw74a.cloudfront.net/%40matheusms21%2FportaDoSol%2F0.0.1%2Fecb187f580b4c9bbd9873239fc05375e-38.0.0-android.js","releaseChannel":"default","hostUri":"exp.host/#matheusms21/portaDoSol"}
Error: ENOENT: no such file or directory, open '/app/turtle/workingdir/android/sdk38/android-shell-app/app/src/main/res/drawable/splashscreen.xml'
The strange thing is that yesterday I managed to finish the build, but today I have this error, and I did not make any changes to SplashScreen or anything like that.
Thanks to anyone who can help me.
Now the build finished without the error.
It was probably their mistake that was corrected at this point.
Thank you all :)
I'm not sure what exactly is happening but I am unable to run react-native link without errors occuring
CLI Output:
react-native link --verbose
debug Available platforms: iOS, Android
debug Targeted platforms: iOS, Android
debug Getting project config for iOS...
debug Getting project config for Android...
error No package found. Are you sure this is a React Native project?
error Unexpected close tag
Line: 22
Column: 24
Char: >
debug Error: Unexpected close tag
Line: 22
Column: 24
Char: >
at error (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/node_modules/sax/lib/sax.js:666:10)
at strictFail (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/node_modules/sax/lib/sax.js:692:7)
at closeTag (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/node_modules/sax/lib/sax.js:885:9)
at SAXParser.write (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/node_modules/sax/lib/sax.js:1447:13)
at new XmlDocument (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/lib/xmldoc.js:199:15)
at readManifest (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/#react-native-community/cli/build/tools/android/readManifest.js:44:10)
at Object.projectConfig (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/#react-native-community/cli/build/tools/android/index.js:66:46)
at Object.keys.forEach.platform (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/#react-native-community/cli/build/commands/link/getProjectConfig.js:25:62)
at Array.forEach (<anonymous>)
at getProjectConfig (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/#react-native-community/cli/build/commands/link/getProjectConfig.js:22:35)
This randomly started happening after attempting to npm install react-native-firebase.
What I've tried
clear-caches
remove node_modules and npm install
Checking out my code back to a previous commit
Adding my package name to the manifest locaed in /android/app/src/debug/AndroidManifest.xml
Removing the app from my computer and cloning it from github
Running react-native link on another project, which works, but i just can't run react-native link on this specific project.
So the answer to my question was that in my android manifest xml file, there was an incorrect closing brace for one of my intent filters.
So for anyone that this happens to ensure that all of your Android files have correct syntax.
I fixed this problem by closing some unclosed tag in android/app/src/main/androidManifest.xml. Try checking the file line by line.
when I try to run my app on the iOS simulator I get the error :
Error running xcrun simctl openurl booted exp://localhost:19000: An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=60):
The operation couldn’t be completed. Operation timed out
Operation timed out
Error installing or running app. Error: Process exited with non-zero code: 60
any idea how to solve this error ?
This usually is an error with the Simulator. If you remove expo (delete the app) from the simulator and run the command again, it should build fine.
However, if it still fails, Erasing all content and settings on the simulator does the trick too.
FOUNT IT!
you must have a .watchmanconfig file (like below)
File example
When you initialize a project with expo init "projectname", there is no .watchmanconfig file.
So, create one and in this file, just initialize an empty object like this : {}
Then you can start with expo start or yarn/npm start
It solved all my problem.
Hope it does for you too.
For anyone like me also searching this issue, it is possible to un-eject your app and run again like normal. From the docs, Delete the ios and android directories from your project. Delete the isDetached and detach keys from your project's app.json. You can now use your project like a normal Expo project (with no ExpoKit). Read more at https://docs.expo.io/versions/latest/expokit/advanced-expokit-topics/
It may be an issue with some outdated simulators in your simulator cache. On MacOS remove the sub-directories in the following directory:
~/Library/Developer/CoreSimulator/Caches/
check if you have .watchmanconfig file present in root, if not create one .watchmanconfig and initialize empty object and run command npm start again
When using react-native 0.28 and above (0.29, 0.30-rc), I get the following error when executing react-native run-android in a fresh react-native init app project.
Could not find com.android.support:support-v4:23.2.1.
I installed the newest android studio and even installed the obsolete library manually.
What am I doing wrong?
Thanks!
To complete Tonithy's answer - the .jar may not be enough, you need to copy two whole directories, otherwise gradle will complain for the missing .aar. In this case, I think that those were installed by Android Studio:
{USER}/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.2.1/
And don't forget the dependency:
{USER}/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/23.2.1/
I had exactly the same problem while upgrading to react-native 0.30, that solved the issue.
Google seems to have stopped including a version of each support library without sources/javadoc/etc and React is looking for this specific file. Assuming you manually installed the obsolete version, it will be in {YOUR_ANDROID_LOCATION}/extras/android/support/v4/android-support-v4.jar Your best bet is to manually copy it in:
cp {YOUR_ANDROID_LOCATION}/extras/android/support/v4/android-support-v4.jar {YOUR_ANDROID_LOCATION}/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
This a React Native (version and probably OSX specific bug), it will probably be fixed soon. For posterity, your full error was something like this, looking for support in all the wrong places:
OsagieTheGreat-MBA:somereactapp osagiethegreat$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.android.support:support-v4:23.2.1.
Searched in the following locations:
file:/Users/osagiethegreat/.m2/repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
file:/Users/osagiethegreat/.m2/repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
file:/Users/osagiethegreat/Documents/somereactapp/node_modules/react-native/android/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
file:/Users/osagiethegreat/Documents/somereactapp/node_modules/react-native/android/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
file:/Applications/Android Dev/sdk/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
file:/Applications/Android Dev/sdk/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
file:/Applications/Android Dev/sdk/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
file:/Applications/Android Dev/sdk/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
Required by:
SomeReactApp:app:unspecified > com.android.support:appcompat-v7:23.0.1
SomeReactApp:app:unspecified > com.facebook.react:react-native:0.29.0 > com.android.support:recyclerview-v7:23.0.1
> Could not find com.android.support:support-v4:23.2.1.
Searched in the following locations:
file:/Users/osagiethegreat/.m2/repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
file:/Users/osagiethegreat/.m2/repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
file:/Users/osagiethegreat/Documents/somereactapp/node_modules/react-native/android/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
file:/Users/osagiethegreat/Documents/somereactapp/node_modules/react-native/android/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
file:/Applications/Android Dev/sdk/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
file:/Applications/Android Dev/sdk/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
file:/Applications/Android Dev/sdk/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
file:/Applications/Android Dev/sdk/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
Required by:
SomeReactApp:app:unspecified > com.facebook.react:react-native:0.29.0 > com.facebook.fresco:imagepipeline-okhttp3:0.11.0 > com.facebook.fresco:imagepipeline:0.11.0
SomeReactApp:app:unspecified > com.facebook.react:react-native:0.29.0 > com.facebook.fresco:fresco:0.11.0 > com.facebook.fresco:drawee:0.11.0
SomeReactApp:app:unspecified > com.facebook.react:react-native:0.29.0 > com.facebook.fresco:imagepipeline-okhttp3:0.11.0 > com.facebook.fresco:imagepipeline:0.11.0 > com.facebook.fresco:imagepipeline-base:0.11.0
* 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: 10.838 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
I also got this error, after installing Android Support Library the error has gone.
Install Android Support Library from Extras
First solution could be adding this
compile 'com.android.tools:sdklib:23.2.1'
to the next file
android/app/build.gradle
Second solution is installing Android Support Repository
To Complete Tonithy's and Simon's answer, yes the jar itself was not enough, all the files of two directories -
extras/android/m2repository/com/android/support/support-v4/23.2.1/ and
extras/android/m2repository/com/android/support/support-annotations/23.2.1/ are needed. On my Windows PC, I couldn't find files of these directories anywhere.
So what I did was, I downloaded these folders from googlesource
1. support/support-annotations/23.2.1
Download tgz of above folder and extract the files into {YOUR_ANDROID_LOCATION}/extras/android/m2repository/com/android/support/support-annotations/23.2.1/
2. support/support-v4/23.2.1
Download tgz of above folder and extract the files into {YOUR_ANDROID_LOCATION}/extras/android/m2repository/com/android/support/support-v4/23.2.1/
Now go to your command propmt or terminal and run react-native run-android
Hope it save someone few hours!!