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
I run npx react-native run-android and I get this
This seems to be the problem, It's looking for platform tools in ~/ and not in ~/Android/Sdk
java.io.IOException: Cannot run program "/home/u/platform-tools/adb": error=2, No such file or directory
`
You can ignore this, stack won't let me post this if I don't add more text, but I think it's already a good explanation
> Task :app:compileDebugJavaWithJavac
> Task :app:stripDebugDebugSymbols
Unable to strip the following libraries, packaging them as they are: libbetter.so, libc++_shared.so, libevent-2.1.so, libevent_core-2.1.so, libevent_extra-2.1.so, libfabricjni.so, libfb.so, libfbjni.so, libflipper.so, libfolly_futures.so, libfolly_json.so, libglog.so, libglog_init.so, libimagepipeline.so, libjsc.so, libjscexecutor.so, libjsi.so, libjsijniprofiler.so, libjsinspector.so, liblogger.so, libmapbufferjni.so, libnative-filters.so, libnative-imagetranscoder.so, libreact_codegen_rncore.so, libreact_debug.so, libreact_nativemodule_core.so, libreact_render_animations.so, libreact_render_attributedstring.so, libreact_render_componentregistry.so, libreact_render_core.so, libreact_render_debug.so, libreact_render_graphics.so, libreact_render_imagemanager.so, libreact_render_leakchecker.so, libreact_render_mapbuffer.so, libreact_render_mounting.so, libreact_render_runtimescheduler.so, libreact_render_scheduler.so, libreact_render_telemetry.so, libreact_render_templateprocessor.so, libreact_render_textlayoutmanager.so, libreact_render_uimanager.so, libreact_utils.so, libreactconfig.so, libreactnativeblob.so, libreactnativejni.so, libreactnativeutilsjni.so, libreactperfloggerjni.so, librrc_image.so, librrc_modal.so, librrc_progressbar.so, librrc_root.so, librrc_scrollview.so, librrc_slider.so, librrc_switch.so, librrc_text.so, librrc_textinput.so, librrc_unimplementedview.so, librrc_view.so, libturbomodulejsijni.so, libyoga.so.
> Task :app:installDebug FAILED
31 actionable tasks: 31 executed
Note: /home/u/Desktop/workdir/Math_App/mathapp/android/app/src/debug/java/com/mathapp/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
[adb]: Cannot run program "/home/u/platform-tools/adb": error=2, No such file or directory
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> java.io.IOException: Cannot run program "/home/u/platform-tools/adb": error=2, No such file or directory
* 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 13m 4s
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/u/Desktop/workdir/Math_App/mathapp/android/app/src/debug/java/com/mathapp/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
[adb]: Cannot run program "/home/u/platform-tools/adb": error=2, No such file or directory
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> java.io.IOException: Cannot run program "/home/u/platform-tools/adb": error=2, No such file or directory
* 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 13m 4s
at makeError (/home/u/Desktop/workdir/Math_App/mathapp/node_modules/#react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
at /home/u/Desktop/workdir/Math_App/mathapp/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 (/home/u/Desktop/workdir/Math_App/mathapp/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/home/u/Desktop/workdir/Math_App/mathapp/node_modules/#react-native-community/cli/build/index.js:192:9)
Check where your $ANDROID_HOME variable is pointing to.
echo $ANDROID_HOME
If must be equal to the path of Android/Sdk, usually at ~/Android/Sdk
A solution, if you know where the variable ANDROID_HOME is (maybe ~/.bashrc, ~/.profile):
Go to the file you've the var ANDROID_HOME and edit it so it looks like this
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
After you changed them, do source .bashrc or source {whatever file they're on} and it should work (it works on the terminal you did it, it, do it in whatever terminal you want it to work, if it's on .bashrc it'll work next time you restart without doing source)
That's how it's done if Android is installed in ~/ (you can check out by doing cd, and then ls, Android should appear, if it didn't, change $HOME for the direction of where you installed it).
If you don't have those variables at all: just open ~/.bashrc and add them to the file. And do the same as it's explained before.
And yeah, that's it. I'd appreciate if someone translated this to the Windows and Mac way.
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.
I am making a nativescript app and want to add a carousel by using nativescript-ng2-carousel but after I did npm i nativescript-ng2-carousel I get an error saying
Warning: there already is an extend called com.tns.NativeScriptActivity.
Warning: there already is an extend called com.tns.FragmentClass.
Exception in thread "main" java.io.IOException: File already exists. This may lead to undesired behavior.
Please change the name of one of the extended classes.
File:D:\Documents\coursera_examples\nativescript\VilcabambaHotel\platforms\android\app\src\main\java\com\tns\gen\java\lang\Object_button_19_32_ClickListenerImpl.java Class:
at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:81)
at org.nativescript.staticbindinggenerator.Main.main(Main.java:47)
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:runSbg'.
Process 'command 'C:\Program Files\Android\Android Studio\jre\bin\java.exe'' finished with non-zero exit value 1
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 10s
Command gradlew.bat failed with exit code 1
I have tried updating my typescript, I have deleted node_modules and reinstalled, I have removed and added platforms and still get the same error
I used jenkins to build android image nightly, and then found even the make and cp command failure,the jenkins still finished success.
The last build setup is to copy log file to job directory, so maybe it succeed,and then jenkins finished SUCCESS.
And the Text-finder plugin can only set build unstable not failure, so how to make the build failure when make fails.
The log is like this:
make: \*** No rule to make target \`device/vendor/product/google_frameworks/Google_Play.apk', needed by `out/target/product/device/system/app/Google_Play.apk'. Stop.
make: *** Waiting for unfinished jobs....
target R.java/Manifest.java: FileBrowser(out/target/common/obj/APPS/FileBrowser_intermediates/src/R.stamp)
Warning: AndroidManifest.xml already defines versionCode (in http://schemas.android.com/apk/res/android); using existing value in manifest. untranslatable but exists in locale 'zh_CN'
aapt: warning: string 'pref_development_uastring' has no default translation in packages/apps/Browser/res; found: zh_CN zh_TW
Note: Recompile with -Xlint:unchecked for details.
======================>End<=======================
cp: cannot stat `/home/jenkins/job_name/source/out/target/product/device/package.img': No such file or directory
Extended Email Publisher is currently disabled in project settings
Finished: SUCCESS
The Jenkins job is marked as successfull if the last command of the script has succeed.
A simple workaround is to specify set -e at the begginning of your bash script.
-e Exit immediately if a command exits with a non-zero status.
You can also specify a trap: trap 'exit 1' ERR, to stop the script if an error occurs.