Error React Native run Android - Task :app:compileDebugJavaWithJavac FAILED - java

I have an app running perfectly on iOS but when I try to run on Android, I get the Task :app:compileDebugJavaWithJavac FAILED error, tried some internet solutions but nothing solved the problem. When I run npx react-native run-android I get the error below:
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.7/userguide/command_line_interface.html#sec:command_line_warnings
368 actionable tasks: 2 executed, 366 up-to-date
/Users/danieldobereiner/Documents/GitHub/Empatho-App-React-Native/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:120: error: cannot find symbol
new AppCenterReactNativeAnalyticsPackage(getApplication(), getResources().getString(com.empathoapp.R.string.appCenterAnalytics_whenToEnableAnalytics)),
^
symbol: variable appCenterAnalytics_whenToEnableAnalytics
location: class string
/Users/danieldobereiner/Documents/GitHub/Empatho-App-React-Native/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:121: error: cannot find symbol
new AppCenterReactNativeCrashesPackage(getApplication(), getResources().getString(com.empathoapp.R.string.appCenterCrashes_whenToSendCrashes)),
^
symbol: variable appCenterCrashes_whenToSendCrashes
location: class string
Note: /Users/danieldobereiner/Documents/GitHub/Empatho-App-React-Native/android/app/src/debug/java/com/empathoapp/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 39s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/danieldobereiner/Documents/GitHub/Empatho-App-React-Native/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:120: error: cannot find symbol
new AppCenterReactNativeAnalyticsPackage(getApplication(), getResources().getString(com.empathoapp.R.string.appCenterAnalytics_whenToEnableAnalytics)),
^
symbol: variable appCenterAnalytics_whenToEnableAnalytics
location: class string
/Users/danieldobereiner/Documents/GitHub/Empatho-App-React-Native/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:121: error: cannot find symbol
new AppCenterReactNativeCrashesPackage(getApplication(), getResources().getString(com.empathoapp.R.string.appCenterCrashes_whenToSendCrashes)),
^
symbol: variable appCenterCrashes_whenToSendCrashes
location: class string
Note: /Users/danieldobereiner/Documents/GitHub/Empatho-App-React-Native/android/app/src/debug/java/com/empathoapp/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.```
Tried to change JAVA PATH, I have no idea what could I do to fix that

Related

My Flutter Android folder shows an error and I don't understand where the error is

There one pop up about Java that tell me to update it and I accidentally clicked on it. I am doing Geo location apps and after that, my Android folder got error, like this.
[C:\myapp\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:19: error: cannot access OnCompletionListener
flutterEngine.getPlugins().add(new com.baseflow.geolocator.GeolocatorPlugin());
^
class file for com.baseflow.geolocator.OnCompletionListener not found
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 21s
Exception: Gradle task assembleDebug failed with exit code 1][1]

Execution failed for task ':react-native-gesture-handler:compileDebugJavaWithJavac' with Android Studio Virtual Device

I can't setup properly what I am doing, let's explain as much as I can : I work with someone who started an Ignite project with the Andross package, I cloned the repo and tried to run the app using this tutorial, I did everything properly and was able to run my virtual device, but I had to chmod 777 my node_modules/ and my android/ for some reasons, and yet it won't work, I read here that i had to npm i jetifier but it didn't do much, tbh I have no idea what I'm doing, I really require help.
This is what I get when trying to react-native run-android :
react-native run-android
warn The following packages use deprecated "rnpm" config that will stop working from next release:
- react-native-vector-icons: https://github.com/oblador/react-native-vector-icons
Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
- react-native-device-info (to unlink run: "react-native unlink react-native-device-info")
- react-native-gesture-handler (to unlink run: "react-native unlink react-native-gesture-handler")
- react-native-i18n (to unlink run: "react-native unlink react-native-i18n")
- react-native-vector-icons (to unlink run: "react-native unlink react-native-vector-icons")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1007 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...
> Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED
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.4.1/userguide/command_line_interface.html#sec:command_line_warnings
27 actionable tasks: 1 executed, 26 up-to-date
/home/justicemadness/Documents/Work/Ideel/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java:3: error: package androidx.core.util does not exist
import androidx.core.util.Pools;
^
/home/justicemadness/Documents/Work/Ideel/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java:19: error: package Pools does not exist
private static final Pools.SynchronizedPool<RNGestureHandlerEvent> EVENTS_POOL =
^
/home/justicemadness/Documents/Work/Ideel/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java:3: error: package androidx.core.util does not exist
import androidx.core.util.Pools;
^
/home/justicemadness/Documents/Work/Ideel/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java:19: error: package Pools does not exist
private static final Pools.SynchronizedPool<RNGestureHandlerStateChangeEvent> EVENTS_POOL =
^
/home/justicemadness/Documents/Work/Ideel/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java:20: error: package Pools does not exist
new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
^
/home/justicemadness/Documents/Work/Ideel/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java:20: error: package Pools does not exist
new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
^
Note: /home/justicemadness/Documents/Work/Ideel/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
6 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-gesture-handler:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/home/justicemadness/Documents/Work/Ideel/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java:3: error: package androidx.core.util does not exist
import androidx.core.util.Pools;
^
/home/justicemadness/Documents/Work/Ideel/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java:19: error: package Pools does not exist
private static final Pools.SynchronizedPool<RNGestureHandlerEvent> EVENTS_POOL =
^
/home/justicemadness/Documents/Work/Ideel/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java:3: error: package androidx.core.util does not exist
import androidx.core.util.Pools;
^
/home/justicemadness/Documents/Work/Ideel/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java:19: error: package Pools does not exist
private static final Pools.SynchronizedPool<RNGestureHandlerStateChangeEvent> EVENTS_POOL =
^
/home/justicemadness/Documents/Work/Ideel/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java:20: error: package Pools does not exist
new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
^
/home/justicemadness/Documents/Work/Ideel/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java:20: error: package Pools does not exist
new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
^
Note: /home/justicemadness/Documents/Work/Ideel/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
6 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-gesture-handler:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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
at checkExecSyncError (child_process.js:601:13)
at execFileSync (child_process.js:621:13)
at runOnAllDevices (/usr/local/lib/node_modules/react-native/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:75:39)
at buildAndRun (/usr/local/lib/node_modules/react-native/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:169:41)
at then.result (/usr/local/lib/node_modules/react-native/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:135:12)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
I will gladly give any other information you guys need to help me.
Latest version of react-native requires AndroidX. you have to jetify the project, until the maintainers updates their package, using:
npm install --save-dev jetifier && npx jetify
after that just
react-native run-android

issues to build APK react native app in Ubuntu [duplicate]

This question already has answers here:
Error:resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found
(4 answers)
Closed 4 years ago.
Configure project :react-native-vector-icons
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
error: resource
android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource
android:style/TextAppearance.Material.Widget.Button.Colored not found.
/home/aras/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/37bde114cf44a5a3196253573d3981be/res/values-v26/values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.
/home/aras/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/37bde114cf44a5a3196253573d3981be/res/values-v26/values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found.
/home/aras/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/37bde114cf44a5a3196253573d3981be/res/values-v26/values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
/home/aras/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/37bde114cf44a5a3196253573d3981be/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/fontStyle not found.
/home/aras/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/37bde114cf44a5a3196253573d3981be/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/font not found.
/home/aras/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/37bde114cf44a5a3196253573d3981be/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/fontWeight not found.
error: failed linking references.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-user-agent:verifyReleaseResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
* 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 2s
75 actionable tasks: 2 executed, 73 up-to-date
Check for gradle dependency for support library version mismatch in your all npm build.gradle.

Something wrong with compiling ionic project?

i have some problems with my ionic project.
I wrote something like
ionic build android --release
And got mistake like:
:compileDebugJava
D:\myApps\mobileApp\shymbulak\platforms\android\src\org\apache\cordova\camera\CordovaUri.java:78: error: cannot find symbol
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
^
symbol: variable M
location: class VERSION_CODES
Note: D:\myApps\mobileApp\shymbulak\platforms\android\src\jp\phi\cordova\plugin\videoplayer\VideoPlayerPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':compileDebugJava'.
Compilation failed; see the compiler error output for details.
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: 3.078 secs
D:\myApps\mobileApp\shymbulak\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "D:\myApps\mobileApp\shymbulak\platforms\android\gradlew cdvBuildDebug -b D:\myApps\mobileApp\shymbulak\platforms\android\build.gradle -
Dorg.gradle.daemon=true"
Error: cmd: Command failed with exit code 1
I have got the same problem. As a workaround, you can configure a fix dependecy for the camera plugin.
in package.json:
"cordovaPlugins": [
...
"cordova-plugin-camera#2.3.0",
...
I think you may be used the wrong version of the plug-in.

4 Errors - error: package com.google.android.gms.appstate ETC

I'm fairly new to this and would like it if someone could like really dumb this down for me. I have been receiving these 4 errors constantly and its pretty frustrating.
I'm currently using Android Studio on a mac. These errors pop up when I try to create the build and I've tried searching online for this problem but this is what I found LINK and still did not help.
/Users/name/Desktop/test/game/BaseGameUtils/src/main/java/com/google/example/games/basegameutils/GameHelper.java
Error:(32, 39) error: package com.google.android.gms.appstate does not exist
Error:(293, 28) error: cannot find symbol variable AppStateManager
Error:(294, 30) error: cannot find symbol variable AppStateManager
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details. Error:Execution failed for task ':BaseGameUtils:compileDebugJava'.
> Compilation failed; see the compiler error output for details.
This doesn't allow me to create any build
Information:BUILD FAILED
/Users/name/Desktop/test/game/BaseGameUtils/src/main/java/com/google/example/games/basegameutils/GameHelper.java:32: error: package com.google.android.gms.appstate does not exist
import com.google.android.gms.appstate.AppStateManager;
^
/Users/name/Desktop/test/game/BaseGameUtils/src/main/java/com/google/example/games/basegameutils/GameHelper.java:293: error: cannot find symbol
builder.addApi(AppStateManager.API);
^
symbol: variable AppStateManager
location: class GameHelper
/Users/name/Desktop/test/game/BaseGameUtils/src/main/java/com/google/example/games/basegameutils/GameHelper.java:294: error: cannot find symbol
builder.addScope(AppStateManager.SCOPE_APP_STATE);
^
symbol: variable AppStateManager
location: class GameHelper
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 errors
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':BaseGameUtils:compileDebugJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
It seems that:
the package com.google.android.gms.appstate is not found. You haven't linked it to your program.
AppStateManager is not recognized, but it is the consequence of the first error.

Categories

Resources