Task :app:compileDebugJavaWithJavac FAILED issue due to rg.wonday.orientation.OrientationPackage - java

I am facing the following issue while running command : 'react-native run-android' , I have tried to make changes in '/Users/ankitkumar/teachersapp_new/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java' but it automatically get reset when running the command. Can anyone please help?
> Task :app:compileDebugJavaWithJavac FAILED
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.3.3/userguide/command_line_interface.html#sec:command_line_warnings
665 actionable tasks: 77 executed, 588 up-to-date
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
/Users/ankitkumar/teachersapp_new/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:63: error: a type with the same simple name is already defined by the single-type-import of OrientationPackage
import org.wonday.orientation.OrientationPackage;
^
/Users/ankitkumar/teachersapp_new/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:158: error: reference to OrientationPackage is ambiguous
new OrientationPackage(),
^
both class com.github.yamill.orientation.OrientationPackage in com.github.yamill.orientation and class org.wonday.orientation.OrientationPackage in org.wonday.orientation match
/Users/ankitkumar/teachersapp_new/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:159: error: reference to OrientationPackage is ambiguous
new OrientationPackage(),
^
both class com.github.yamill.orientation.OrientationPackage in com.github.yamill.orientation and class org.wonday.orientation.OrientationPackage in org.wonday.orientation match
Note: Some input files use or override 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.
3 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 25s
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
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
/Users/ankitkumar/teachersapp_new/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:63: error: a type with the same simple name is already defined by the single-type-import of OrientationPackage
import org.wonday.orientation.OrientationPackage;
^
/Users/ankitkumar/teachersapp_new/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:158: error: reference to OrientationPackage is ambiguous
new OrientationPackage(),
^
both class com.github.yamill.orientation.OrientationPackage in com.github.yamill.orientation and class org.wonday.orientation.OrientationPackage in org.wonday.orientation match
/Users/ankitkumar/teachersapp_new/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:159: error: reference to OrientationPackage is ambiguous
new OrientationPackage(),
^
both class com.github.yamill.orientation.OrientationPackage in com.github.yamill.orientation and class org.wonday.orientation.OrientationPackage in org.wonday.orientation match
Note: Some input files use or override 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.
3 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 25s
I have tried to make changes in '/Users/ankitkumar/teachersapp_new/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java' but it automatically get reset when running the command and the build is unsuccessful.

Follow below steps and check if same issue still exist
If you did any manual linking like mentioned here then revert back all the changes
Run npx react-native unlink react-native-orientation
Run npm uninstall react-native-orientation
Delete node_modules
Delete build folders (android/build & android/app/build)
Run npm install or yarn to install packages
Check if app builds without react-native-orientation package.If yes, goto next next. If no, add the fix mentioned here React Native Android build failure with different errors without any changes in code for past days due to publish of React Native version 0.71.0-rc.0 then check if app works then, execute next step
run npm install react-native-orientation
Run npx react-native link react-native-orientation
Clean & build

Related

how to fix "gradlew genSources"

I'm on windows 10, when I do "gradlew genSources" then this happened
Starting a Gradle Daemon, 7 stopped Daemons could not be reused, use --status for details
> Configure project :
Fabric Loom: 0.10.66
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\user\Downloads\MCJAVA\vector-addon\build.gradle'
* What went wrong:
Could not compile build file 'C:\Users\user\Downloads\MCJAVA\vector-addon\build.gradle'.
> startup failed:
General error during conversion: Unsupported class file major version 62
java.lang.IllegalArgumentException: Unsupported class file major version 62
1 error
* 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.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 5s
I want to know how can i fix it and im not good at coding and my english is not that good, I still tried with --stacktrace it still have similir error please help me
(its have a lot more text in code but its too much and i dont think it important)

Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 (React Native)

I have been facing this error for 2 days on Linux(Ubuntu 20.04) machine, and I have tried almost every possible solution found on stack-overflow and git-hub but I could'not resolve this. Any idea about this error?
Task :app:compileDebugJavaWithJavac
Task :app:mergeDebugJavaResource 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.7/userguide/command_line_interface.html#sec:command_line_warnings
217 actionable tasks: 3 executed, 214 up-to-date
Note: /home/fareed/Data/Office/Alfabolt/DeNaio-Mobile-App/android/app/src/debug/java/com/denaio/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:mergeDebugJavaResource'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Failed to transform bcprov-jdk15on-1.69.jar (org.bouncycastle:bcprov-jdk15on:1.69) to match attributes {artifactType=android-java-res, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: /home/fareed/.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcprov-jdk15on/1.69/91e1628251cf3ca90093ce9d0fe67e5b7dab3850/bcprov-jdk15on-1.69.jar.
> Failed to transform '/home/fareed/.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcprov-jdk15on/1.69/91e1628251cf3ca90093ce9d0fe67e5b7dab3850/bcprov-jdk15on-1.69.jar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 59. (Run with --stacktrace for more details.)
Suggestions:
- Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
- If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).
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 24s
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
Note: /home/fareed/Data/Office/Alfabolt/DeNaio-Mobile-App/android/app/src/debug/java/com/denaio/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:mergeDebugJavaResource'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Failed to transform bcprov-jdk15on-1.69.jar (org.bouncycastle:bcprov-jdk15on:1.69) to match attributes {artifactType=android-java-res, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: /home/fareed/.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcprov-jdk15on/1.69/91e1628251cf3ca90093ce9d0fe67e5b7dab3850/bcprov-jdk15on-1.69.jar.
> Failed to transform '/home/fareed/.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcprov-jdk15on/1.69/91e1628251cf3ca90093ce9d0fe67e5b7dab3850/bcprov-jdk15on-1.69.jar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 59. (Run with --stacktrace for more details.)
Suggestions:
- Check out existing issues at https://issuetracker.google.com/issues?q=componentid:460323&s=modified_time:desc, it's possible that this issue has already been filed there.
- If this issue has not been filed, please report it at https://issuetracker.google.com/issues/new?component=460323 (run with --stacktrace and provide a stack trace if possible).
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 24s
at makeError (/home/fareed/Data/Office/Alfabolt/DeNaio-Mobile-App/node_modules/execa/index.js:174:9)
at /home/fareed/Data/Office/Alfabolt/DeNaio-Mobile-App/node_modules/execa/index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async runOnAllDevices (/home/fareed/Data/Office/Alfabolt/DeNaio-Mobile-App/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
at async Command.handleAction (/home/fareed/Data/Office/Alfabolt/DeNaio-Mobile-App/node_modules/react-native/node_modules/#react-native-community/cli/build/index.js:186:9)

failed to run expo run:android

I got this error when trying to run expo run:android and can't find any solution for it.
> Task :app:compileDebugJavaWithJavac FAILED
/Users/amin/Projects/profishop/taksabad/android/app/src/main/java/com/mapsabad/profishop/generated/BasePackageList.java:1: error: illegal '.'
package com.mapsabad.profishop..generated;
^
/Users/amin/Projects/profishop/taksabad/android/app/src/main/java/com/mapsabad/profishop/MainApplication.java:1: error: <identifier> expected
package com.mapsabad.profishop.;
^
/Users/amin/Projects/profishop/taksabad/android/app/src/main/java/com/mapsabad/profishop/MainApplication.java:14: error: illegal '.'
import com.mapsabad.profishop..generated.BasePackageList;
^
/Users/amin/Projects/profishop/taksabad/android/app/src/main/java/com/mapsabad/profishop/MainActivity.java:1: error: <identifier> expected
package com.mapsabad.profishop.;
^
/Users/amin/Projects/profishop/taksabad/android/app/src/debug/java/com/mapsabad/profishop/ReactNativeFlipper.java:7: error: <identifier> expected
package com.mapsabad.profishop.;
^
5 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
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.8/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 19s
519 actionable tasks: 3 executed, 516 up-to-date
/Users/amin/Projects/profishop/taksabad/android/gradlew exited with non-zero code: 1
Error: /Users/amin/Projects/profishop/taksabad/android/gradlew exited with non-zero code: 1
at ChildProcess.completionListener (/usr/local/lib/node_modules/expo-cli/node_modules/#expo/spawn-async/src/spawnAsync.ts:65:13)
at Object.onceWrapper (node:events:472:26)
at ChildProcess.emit (node:events:365:28)
at maybeClose (node:internal/child_process:1067:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
...
at spawnAsync (/usr/local/lib/node_modules/expo-cli/node_modules/#expo/spawn-async/src/spawnAsync.ts:26:19)
at spawnGradleAsync (/usr/local/lib/node_modules/expo-cli/src/commands/run/android/spawnGradleAsync.ts:44:18)
at actionAsync (/usr/local/lib/node_modules/expo-cli/src/commands/run/android/runAndroid.ts:110:9)
I also tried expo eject and then run npx react-native run-android bug I got same error again.
react native version : 0.63.4
Anyone have an idea to fix this issue?
Remove the trailing period from com.mapsabad.profishop. as the logs indicate this as an error in multiple places.
In my case it was because I had the word "native" in the package name in ReactNativeFlipper. Think it got copied from the name field in my app.json Expo file. The word "native" was even marked in red text when I opened the file so I solved it by renaming it.

Building Android app in Ubuntu 16 Docker Container ( Oracle JDK 8 & MVN)

Below stacktrace is for android build. And execution is failed for command: ./gradlew -qq assembleStandardDebug assembleStandardDebugAndroidTest
To verify Gradle is fine tried command ./gradlew tasks" but it completed successfully
Then started debugging for dependency issues but didn't get much stacktrace. This is the first time I am trying to build an android project and also trying on docker container. If anyone have idea please let me know.
15:08:19 ANTLR Tool version 4.5.3 used for code generation does not
match the current runtime version 4.7.1ANTLR Runtime version 4.5.3
used for parser compilation does not match the current runtime version
4.7.1ANTLR Tool version 4.5.3 used for code generation does not match the current runtime version 4.7.1ANTLR Runtime version 4.5.3 used for
parser compilation does not match the current runtime version 4.7.1
ui/utils/UiHelper.java:202: warning: Application namespace for
attribute app:imageSrc will be ignored. 15:08:19 public static
void setImageUrl(ImageView imageView, String image) { 15:08:19
^ 15:08:25 Note: Some input files use or override a deprecated API.
15:08:25 Note: Recompile with -Xlint:deprecation for details.
15:08:25 Note: Some input files use unchecked or unsafe operations.
15:08:25 Note: Recompile with -Xlint:unchecked for details. 15:08:25
1 warning 15:10:17 15:10:17 FAILURE: Build failed with an
exception. 15:10:17 15:10:17 * What went wrong: 15:10:17 Execution
failed for task ':app:javaPreCompileStandardDebugAndroidTest'.
15:10:17 > Could not resolve all files for configuration
':app:standardDebugAndroidTestCompileClasspath'. 15:10:17 > Failed
to transform artifact 'cucumber-java.jar
(io.cucumber:cucumber-java:3.0.2)' to match attributes
{artifactType=android-classes, org.gradle.libraryelements=jar,
org.gradle.usage=java-runtime}. 15:10:17 > Execution failed for
JetifyTransform:
/root/.gradle/caches/modules-2/files-2.1/io.cucumber/cucumber-java/3.0.2/6b1790c541528f8b3a47/cucumber-java-3.0.2.jar.
15:10:17 > Failed to transform
'/root/.gradle/caches/modules-2/files-2.1/io.cucumber/cucumber-java/3.0.2/6b1790c541528f8b3a47/cucumber-java-3.0.2.jar'
using Jetifier. Reason: Malformed input or input contains unmappable
characters: cucumber/api/java/sk/Ataktie?.class. (Run with
--stacktrace for more details.) 15:10:17 15:10:17 * Try: 15:10:17 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.

Cordova project Build time show Error -- Build Failed

When try to build cordova project in cmd with
android 6.4.0 also try android 7.1.0 but still showing build failed
Below Error Show after build cordova project
cordova build android
ANDROID_HOME=G:\shripati\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x
86_64-20140702\sdk JAVA_HOME=C:\Program Files\Java\jdk1.8.0_172
Subproject Path: CordovaLib Observed package id 'build-tools;20.0.0'
in inconsistent location 'G:\shripati\a
dt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\build-t
ools\android-4.4W' (Expected
'G:\shripati\adt-bundle-windows-x86_64-20140702\adt
-bundle-windows-x86_64-20140702\sdk\build-tools\20.0.0')
FAILED BUILD FAILED Total time: 50.818 secs FAILURE: Build failed with
an exception. * What went wrong: Execution failed for task
':processDebugResources'.
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. (node:6448)
UnhandledPromiseRejectionWarning: Error: cmd: Command failed with ex
it code 1 Error output: Note: Some input files use or override a
deprecated API. Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API. Note:
Recompile with -Xlint:deprecation for details. ERROR: In
FontFamilyFont, unable to find attribute android:f ont ERROR: In
FontFamilyFont, unable to find attribute android:f ontStyle ERROR: In
FontFamilyFont, unable to find attribute android:f
ontVariationSettings ERROR: In FontFamilyFont, unable to find
attribute android:f ontWeight ERROR: In FontFamilyFont, unable to find
attribute android:t tcIndex FAILURE: Build failed with an exception. *
What went wrong: Execution failed for task ':processDebugResources'.
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. at
ChildProcess.whenDone
(D:\shri\convertVisualStudio\shri\LBSCRM\platforms\
android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at ChildProcess.emit (events.js:182:13) at maybeClose
(internal/child_process.js:957:16) at
Process.ChildProcess._handle.onexit (internal/child_process.js:246:5)
(node:6448) UnhandledPromiseRejectionWarning: Unhandled promise
rejection. This error originated either by throwing inside of an async
function without a catch block, or by rejecting a promise which was
not handled with .catch(). (rejection id: 1) (node:6448) [DEP0018]
DeprecationWarning: Unhandled promise rejections are depre cated. In
the future, promise rejections that are not handled will terminate the
Node.js process with a non-zero exit code.
These resources were only added in the android-P preview, so if you want to use a library that references them you need to update your compile sdk to android-P preview, you can follow this guide.

Categories