React Native Fails When I Try To Run on Emulator - javascript

today I just created my first React Native project but when I tried to run it on my avd just like;
react-native run-android
but it always gives this:
info JS server already running.
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...
Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:checkDebugManifest UP-TO-DATE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:bundleDebugJsAndAssets SKIPPED
> Task :app:prepareLintJar UP-TO-DATE
> Task :app:generateDebugSources UP-TO-DATE
> Task :app:javaPreCompileDebug
> Task :app:mainApkListPersistenceDebug UP-TO-DATE
> Task :app:generateDebugResValues
> Task :app:generateDebugResources
> Task :app:mergeDebugResources
> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:processDebugManifest UP-TO-DATE
> Task :app:processDebugResources
> Task :app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /usr/lib/jvm/java-8-openjdk/jre contains a valid JDK installation.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 26s
12 actionable tasks: 5 executed, 7 up-to-date
error 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/getting-started.html
error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.
I don't know what should I do and I totally need your help.
Thanks for your attention.

It was a problem with system looking at the JRE folder i.e. /usr/lib/jvm/java-8-openjdk/jre. If we look in there, there is no Tools.jar, hence the error.
You can create environment variables JAVA_HOME :
Inside Variable value add your JDK in place of jdk1.8.0_11
Now edit yout PATH variable to add JAVA_HOME :
Now try to run the command again .
OR
Check this path C:\Program Files\Android\Android Studio\jre\lib if you find tools.jar there then try setting JAVA_HOME=C:\Program Files\Android\Android Studio\jre in above enviroment variable.
For Linux Users -
Edit the system Path file /etc/profile
sudo gedit /etc/profile
Add following lines in end
JAVA_HOME=/usr/lib/jvm/jdk1.7.0
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
In place of jdk1.7.0 add your JDK version.
Then Log out and Log in ubuntu for setting up the paths...
Hope it works !

Hi. You need to check if JDK is properly installed and verify that you have added the environment variables JAVA_HOME & JDK_HOME.

Related

I constantly get this error when creating APK in React native application

I constantly get this error when creating APK in React native application.
Could you please help?
I have tried all of the codes below.
react-native bundle --platform android --dev false --entry-file
index.js --bundle-output
android/app/src/main/assets/index.android.bundle --assets-dest
android/app/src/main/res
gradlew clean
gradlew assembleRelease -x bundleReleaseJsAndAssets or gradlew
bundleRelease
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> C:\Users\Emre Can\Desktop\ReactNative\bulutmd\android\app\src\main\res\drawables\launch_screen.png: Error: The file name must end with .xml
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
BU¦LD FAILED in 2m 46s
159 actionable tasks: 127 executed, 32 up-to-date
PS C:\Users\Emre Can\Desktop\ReactNative\bulutmd\android>
* History restored
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\Emre Can\Desktop\ReactNative> cd bulutmd
PS C:\Users\Emre Can\Desktop\ReactNative\bulutmd> cd android
PS C:\Users\Emre Can\Desktop\ReactNative\bulutmd\android>
guys i have fixid this error using react native old version 0.68.0....
newer version of react native are fixing this problem like
0.70.2,0.70.2 are
so plz change your project with old version,hope this guide helps you..

React Native, why react-native run-android not working?

I'm trying to run react native run-android after I update my project file, but whenever I run react-native it throws an error. When I created that project and that command it worked fine but when I edit and add some files like apps/redux, apps/components, screens etc it stopped working. Can anyone tell me why it's not working?
error Failed to launch emulator. Reason: Could not start emulator within 30 seconds..
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
> Task :app:compileDebugJavaWithJavac
> Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.
> Task :app:installDebug FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings
27 actionable tasks: 6 executed, 21 up-to-date
Note: C:\Users\Danger World\ReactProject\android\app\src\debug\java\com\reactproject\ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 11s
error Failed to install the app. Make sure you have an Android emulator running or a device connected. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Note: C:\Users\Danger World\ReactProject\android\app\src\debug\java\com\reactproject\ReactNativeFlipper.java uses or overrides a deprecated API.
you either need to create a virtual device or connect a physical device with USB debuging enabled (https://developer.android.com/studio/debug/dev-options).
To create a virtual device, open android studio and select AVD manager from Configure menu and create a new virtual device downloading required packages.
In case you are using a virtual device with Android studio then try to manually run the emulator BEFORE react-native run-android.
(open android studio > Tools > AVD Manager > Create Virtual Device)
https://developer.android.com/studio/run/managing-avds#createavd
Or repeat the official installation guide:
https://reactnative.dev/docs/environment-setup

Android Studio React Native Build fails

I took the project I am developing at my workplace home and wanted to run it here on my machine.
I got many many errors which I fixed, but there are some that I don't know how. Maybe you guys know a fix.
\android\app\build\intermediates\external_file_lib_dex_archives\debug\out
this output get generated when building the project from AS.
I read that the fix is to add this: android.enableBuildCache=false to gradle.properties but when I do that I get this error which make 0 sense tbh.
: Cannot parse project property android.enableBuildCache='false ' of type 'class java.lang.String' as boolean. Expected 'true' or 'false'.
EDIT: Ok there was an empty space after false hence the second error but even with that corrected I get the first error.
Running it from vsCode gives me: Execution failed for task ':app:processDebugResources'.
EDIT2: Newest Error in AS:
> Task :app:mergeExtDexDebug
java.nio.file.NoSuchFileException: C:\Users\Faded\Desktop\Development\React Native\FitnessApp\FitnessApp\android\app\build\intermediates\external_file_lib_dex_archives\debug\out
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsDirectoryStream.<init>(WindowsDirectoryStream.java:80)
at sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:522)
at java.nio.file.Files.newDirectoryStream(Files.java:457)
at java.nio.file.Files.list(Files.java:3451)
at com.android.build.gradle.internal.tasks.DexMergingParams.getAllDexFiles(DexMergingTask.kt:502)
at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:423)
at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:335)
at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:50)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:50)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:65)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:61)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:53)
at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:217)
at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:212)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.lang.Thread.run(Thread.java:748)
> Task :app:transformClassesWithDexBuilderForDebug
> Task :app:validateSigningDebug UP-TO-DATE
> Task :app:signingConfigWriterDebug
> Task :app:mergeDebugJavaResource
> Task :app:mergeExtDexDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeExtDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> java.nio.file.NoSuchFileException: C:\Users\Faded\Desktop\Development\React Native\FitnessApp\FitnessApp\android\app\build\intermediates\external_file_lib_dex_archives\debug\out
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 19s
150 actionable tasks: 147 executed, 3 up-to-date
Try to delete the .gradle folder from projectname/android - folder and rebuild. Solved it for me.
I have encountered a similar error before. As a result of my research as a solution
In the android/app/build.gradle file multiDexEnabled true
android {
defaultConfig {
...
targetSdkVersion 28
multiDexEnabled true // here
}
...
}
As Murat Kızılöz suggested, you can get around this by adding multiDexEnabled truein the android/app/build.gradle file.
This is because Android system has a 64K reference limit
In Android, the compilers convert your source code into DEX files. This DEX file
contains the compiled code used to run the app. But there is a limitation with the
DEX file. The DEX file limits the total number of methods that can be referenced
within a single DEX file to 64K i.e. 65,536 methods. So, you cant use more than
64K methods in a particular DEX file. These 64K methods include Android framework
methods, library methods, and methods in our code also. This limit of 64K is
referred to as the "64K reference limit".
So, if our app exceeds 65,536 methods, we will encounter a build error that indicates our app has reached the limit of the Android build architecture.
To get around this, you can manually enable this in the app build.gradle file
You can read more about this at Android Multidex
Try this command in your project root:
cd android && rm -rf .gradle && rm -rf .idea
and then
./gradlew clean
and then build again, works like a charm.
You can solve this issue by deleting the .gradle folder from "NameOfProject/android" and again running Android-Studio, I hoped this is solved. :))

How can I delete Android Studio project located in ionic project?

I have an ionic project, and for now the unique platform that i am built for is android, all features in project were working fine, previously when i export to APK this project, also works perfectly, the project in that time already had an android studio project linked in, but despite this everything worked fine.
Recently, looking in a page I saw that a project of ionic can be easily imported in android studio clicking on "Import project (Gradle, Eclipse, ADT, etc.)", so I clicked on that option and looked for my .gradle file.
Once I found it, I opened this in Android Studio, some message was displayed importing the project, something like "This version of gradle seems to be older, we recommend to update gradle, click here to update gradle", so i clicked in, but doesn't install successfully, for other errors...
As I didn't know what to do, I simply closed Android Studio, and tried to build APK once again but from the CMD, my APK was successfully built.
But now when I install the APK, run the APK and try to use the functionality of 2 plugins, one plugin simple doesn't works, but don't close me the application (imagePicker).
In case of the other plugin (googleMaps), when i try to change to the page where i using googleMaps, the app will simple got closed.
(I think was android studio gradle opened and attempted to upgrade and this break the plugins functionality).
Other thing that was changed is that previously when i run command:
ionic cordova build android -c
the output APK looks like:
app-debug.apk
now when i run this command the name is something like:
android-debug.apk
This thing means that I will never be able to run command:
ionic cordova run android
because the installation apk name that is recognized for the command is app-debug, not android-debug.
This is the output, but if i try to remove android platform and add it again, an error happens if y try to run:
ionic cordova build android -c
this is the output that i'm getting using android 6.4.0:
cordova-android-support-gradle-release: Android platform: V6
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\build.gradle
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\cordova-android-support-gradle-release\starter-cordova-android-support-gradle-release.gradle
cordova-android-support-gradle-release: Android platform: V6
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\build.gradle
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\cordova-android-support-gradle-release\starter-cordova-android-support-gradle-release.gradle
ANDROID_HOME=C:\Users\angela\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_221
Subproject Path: CordovaLib
Starting a Gradle Daemon (subsequent builds will be faster)
+-----------------------------------------------------------------
| cordova-android-support-gradle-release: 27.+
+-----------------------------------------------------------------
Configuration 'compile' in project ':' is deprecated. Use 'implementation' instead.
config.xml
../config.xml
../../config.xml
preference = 10
name = ScrollEnabled, value = false
name = android-minSdkVersion, value = 19
name = BackupWebStorage, value = none
name = SplashMaintainAspectRatio, value = true
name = FadeSplashScreenDuration, value = 300
name = SplashShowOnlyFirstTime, value = false
name = SplashScreen, value = screen
name = SplashScreenDelay, value = 3000
name = AndroidPersistentFileLocation, value = Compatibility
name = GOOGLE_MAPS_ANDROID_API_KEY, value = AIzaSyAP7l8T_EYdETsJfpwtotTE5iDCoMebJlY
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_1v9usha2n179nr38j15ea2rs.run(C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\build.gradle:146)
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
:preBuild UP-TO-DATE
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE
:compileDebugAidl UP-TO-DATE
:CordovaLib:packageDebugRenderscript NO-SOURCE
:compileDebugRenderscript UP-TO-DATE
:checkDebugManifest UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:prepareLintJar UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:createDebugCompatibleScreenManifests UP-TO-DATE
:processDebugManifest UP-TO-DATE
:splitsDiscoveryTaskDebug UP-TO-DATE
:CordovaLib:platformAttrExtractor UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:processDebugResources UP-TO-DATE
:generateDebugSources UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:prepareLintJar UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:javaPreCompileDebug UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes NO-SOURCE
:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
:javaPreCompileDebug UP-TO-DATE
:compileDebugJavaWithJavac UP-TO-DATE
:compileDebugNdk NO-SOURCE
:compileDebugSources UP-TO-DATE
:mergeDebugShaders UP-TO-DATE
:compileDebugShaders UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugShaders UP-TO-DATE
:CordovaLib:compileDebugShaders UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:mergeDebugAssets UP-TO-DATE
:transformClassesWithDexBuilderForDebug UP-TO-DATE
:transformDexArchiveWithExternalLibsDexMergerForDebug UP-TO-DATE
:transformDexArchiveWithDexMergerForDebug UP-TO-DATE
:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:compileDebugNdk NO-SOURCE
:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNativeLibsWithIntermediateJniLibsForDebug UP-TO-DATE
:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
:processDebugJavaRes NO-SOURCE
:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:validateSigningDebug
:packageDebug UP-TO-DATE
:assembleDebug UP-TO-DATE
:cdvBuildDebug UP-TO-DATE
BUILD SUCCESSFUL in 2m 50s
44 actionable tasks: 1 executed, 43 up-to-date
Built the following apk(s):
C:/xampp/htdocs/MyQuestApp/myquestapp/platforms/android/build/outputs/apk/debug/android-debug.apk
But this is the different output that i'm getting if i uninstall platform android and re-add it with:
ionic cordova platform add android
Output when i run ionic cordova build android:
cordova-android-support-gradle-release: Android platform: V7+
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\app\build.gradle
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\cordova-android-support-gradle-release\starter-cordova-android-support-gradle-release.gradle
cordova-android-support-gradle-release: Android platform: V7+
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\app\build.gradle
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\cordova-android-support-gradle-release\starter-cordova-android-support-gradle-release.gradle
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\angela\AppData\Local\Android\Sdk (DEPRECATED)
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Task :wrapper
BUILD SUCCESSFUL in 1m 23s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :app
+-----------------------------------------------------------------
| cordova-android-support-gradle-release: 27.+
+-----------------------------------------------------------------
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
config.xml
../config.xml
../../config.xml
../../../config.xml
preference = 10
name = ScrollEnabled, value = false
name = android-minSdkVersion, value = 19
name = BackupWebStorage, value = none
name = SplashMaintainAspectRatio, value = true
name = FadeSplashScreenDuration, value = 300
name = SplashShowOnlyFirstTime, value = false
name = SplashScreen, value = screen
name = SplashScreenDelay, value = 3000
name = AndroidPersistentFileLocation, value = Compatibility
name = GOOGLE_MAPS_ANDROID_API_KEY, value = AIzaSyAP7l8T_EYdETsJfpwtotTE5iDCoMebJlY
> Task :app:preBuild UP-TO-DATE
> Task :CordovaLib:preBuild UP-TO-DATE
> Task :CordovaLib:preDebugBuild UP-TO-DATE
> Task :CordovaLib:checkDebugManifest
> Task :CordovaLib:processDebugManifest
> Task :app:preDebugBuild
> Task :CordovaLib:compileDebugAidl NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :CordovaLib:packageDebugRenderscript NO-SOURCE
> Task :app:compileDebugRenderscript
> Task :app:checkDebugManifest
> Task :app:generateDebugBuildConfig
> Task :app:prepareLintJar
> Task :app:generateDebugSources
> Task :CordovaLib:compileDebugRenderscript
> Task :CordovaLib:generateDebugBuildConfig
> Task :CordovaLib:generateDebugResValues
> Task :CordovaLib:generateDebugResources
> Task :CordovaLib:packageDebugResources
> Task :CordovaLib:generateDebugRFile
> Task :CordovaLib:prepareLintJar
> Task :CordovaLib:generateDebugSources
> Task :CordovaLib:javaPreCompileDebug
Note: C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\CordovaLib\src\org\apache\cordova\engine\SystemCookieManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :CordovaLib:compileDebugJavaWithJavac
> Task :CordovaLib:processDebugJavaRes NO-SOURCE
> Task :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
> Task :app:javaPreCompileDebug
> Task :app:mainApkListPersistenceDebug
> Task :app:generateDebugResValues
> Task :app:generateDebugResources
> Task :app:mergeDebugResources
> Task :app:createDebugCompatibleScreenManifests
> Task :app:processDebugManifest
> Task :app:processDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
23 actionable tasks: 23 executed
> Android resource linking failed
C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\app\build\intermediates\merged_manifests\debug\AndroidManifest.xml:34: AAPT: error: resource xml/network_security_config (aka io.ionic.starter:xml/network_security_config) not found.
error: failed processing manifest.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3m 5s
C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\gradlew: Command failed with exit code 1 Error output:
Note: C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\CordovaLib\src\org\apache\cordova\engine\SystemCookieManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\app\build\intermediates\merged_manifests\debug\AndroidManifest.xml:34: AAPT: error: resource xml/network_security_config (aka io.ionic.starter:xml/network_security_config) not found.
error: failed processing manifest.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3m 5s
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
The reason i want to delete the android studio project located in ionic project is that i think that the ionic builder is not using the ionic project configurations, ionic is using android studio project configs now to make the apk build, and i think this is the error, but i don't know about any command that 'removes' the android studio project config of an ionic project.

React-Native cannot run project if I am not Sudo

I am unable to run react-native project with the code react-native run-android. I am getting the following error
info Starting JS server...
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not create service of type AnnotationProcessorDetector using JavaGradleScopeServices.createAnnotationProcessorDetector().
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
error 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/getting-started.html
error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.
But it runs if I run it as root `sudo react-native run-andoid'.
How can I make the project run without being root??
I found out from reading the post by Medium that u have to give permission to every folder explicitly when u encounter a permission issue when installing react native and realated tools, so that u can run the app without being sudo. Otherwise the files installed by sudo can only be run as sudo.
Use the below command to give access to the current user for that specific folder
sudo chown -R $(whoami) ~/Documents/Myapplicationfolder

Categories