Something wrong with compiling ionic project? - java

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.

Related

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

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

Error building react native app on Android

Hi I´m trying to run my react native app on android but when i build it shows me this error:
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 952 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
> Task :react-native-safe-area-context:compileDebugJavaWithJavac 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.9/userguide/command_line_interface.html#sec:command_line_warnings
48 actionable tasks: 2 executed, 46 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-safe-area-context:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home 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
BUILD FAILED in 5s
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
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-safe-area-context:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home 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
BUILD FAILED in 5s
at makeError (/Users/calebgarcia/Dev/Auth/node_modules/#react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
at /Users/calebgarcia/Dev/Auth/node_modules/#react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/calebgarcia/Dev/Auth/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:106:5)
at async Command.handleAction (/Users/calebgarcia/Dev/Auth/node_modules/#react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
It´s a bit puzzling since when i build the app on the ios simulator it runs perfectly.
Do you guys have any idea how i can solve the issue?
Thanks.
npm install react-native-safe-area-context
Try this and build.
If not,
Please check your computer's environment variables and set JAVA_HOME if it has not already been setup.

Could not resolve all files for configuration ':app:androidJdkImage

I am trying to build flutter apk on debug mode from android studio.
Flutter run
I get this error:
Launching lib/main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Could not resolve all files for configuration ':app:androidJdkImage'.
Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JdkImageTransform: /Users/mac/Library/Android/sdk/platforms/android-30/core-for-system-modules.jar.
> jlink executable /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/jlink does not exist.
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 20s
Exception: Gradle task assembleDebug failed with exit code 1
I solved this issue by downloading the required NDK side by side
package as shown in this screenshot for the required SDK platform.
If you keep getting errors after doing this, please share error logs or screenshots. Thanks.
In my case, I only need update Android Studio to newer version and it's working normally again.

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

Learning Gradle but getting the following error on workstation

I am learning gradle and I am having issues..
I am using https://github.com/spring-guides/gs-gradle.git as my learning project and I goto
cd in gs-gradle/complete
then I run gradle run and I am getting the following error:
$ gradle build
:compileJava
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not resolve joda-time:joda-time:2.2.
Required by:
:complete:unspecified
> Could not GET 'https://repo1.maven.org/maven2/joda-time/joda-time/2.2/joda-
time-2.2.pom'.
> peer not authenticated
* 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: 6.452 secs
Use the latest version of joda-time. The current version is 2.10.5.
In build.gradle change the dependency to point to compile "joda-time:joda-time:2.10.5"

Categories

Resources