Some issues while running react-native run-android - android

I'm facing these issues the whole day - fixing one to face another one 🤦‍♂️
what's the issue here? - after executing this command
react-native run-android?
the full error :
Task :app:compileDebugJavaWithJavac FAILED
/Users/mohsen/Desktop/roam - copy/roam/roam/android/app/src/main/java/host/exp/exponent/MainApplication.java:39: error: cannot find symbol
return BuildVariantConstants.USE_INTERNET_KERNEL;
^
symbol: variable BuildVariantConstants
location: class MainApplication
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.

There might be some problem in your MainApplication.java. Look for any syntax problem or any other issue you get there. After that you can open Android studio sync your project and see if you get any error there. Update build tools from there if necessary. Maybe it will be sorted by then.

Related

Execution failed for task ':expo:compileReleaseKotlin'

I am building a react native app using eas. Its failing each time i try and i have no idea what could be the issue. `this is the error its showing
Task :expo:compileReleaseKotlin FAILED1470
[stderr] e: /home/expo/workingdir/build/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapperBase.kt: (50, 3): 'getUIImplementationProvider' overrides nothing1471
[stderr] e: /home/expo/workingdir/build/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapperBase.kt: (50, 76): Unresolved reference: UIImplementationProvider1472
[stderr] e: /home/expo/workingdir/build/node_modules/expo/android/src/main/java/expo/modules/ReactNativeHostWrapperBase.kt: (51, 12): Not enough information to infer type variable T1473>
Task :expo-modules-core:buildCMakeRelWithDebInfo[x86_64]1474w:
Detected multiple Kotlin daemon sessions at build/kotlin/sessions1475Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.1476You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.1477See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings1478Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.1479Please consult deprecation warnings for more details.1480377 actionable tasks: 377 executed1481
[stderr] FAILURE: Build failed with an exception.1482
[stderr] * What went wrong:1483[stderr] Execution failed for task ':expo:compileReleaseKotlin'.1484[stderr] > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction1485[stderr] > Compilation error. See log for more details1486
[stderr] * Try:1487[stderr] > Run with --stacktrace option to get the stack trace.1488[stderr] > Run with --info or --debug option to get more log output.1489[stderr] > Run with --scan to get full insights.1490[stderr] * Get more help at https://help.gradle.org1491[stderr] BUILD FAILED in 5m 47s1492Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.
i have tried un installing and reinstalling expo cli on machine which is using linux(Crostini to be precise) because some of the errors it was highlighting were deprecation errors of some of the installed modules. ive tried building it a number of times, revisiting my code and searching online hoping that i may i be able to pin point where its going wrong
The solution that worked for me is to upgrade your react native package to the patch version as described here: https://github.com/facebook/react-native/issues/35210

Flutter build failed with D8: Program type already present

I am developing a flutter app.
I found a sample flutter project so folk it.
But the project... build failed with below log message.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'androidx.core:core' has different version for the compile (1.0.0) and runtime (1.0.1) classpath. You should manually set the same version via DependencyResolution
* 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 0s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility for more information on the problem and how to fix it.
*******************************************************************************************
Finished with error: Gradle task assembleDebug failed with exit code 1
The project is not special.
The android part, there are no other modifications.
It is totally same with the "new flutter project'.
I tried something:
Migration to AndroidX
This is failed with error popup. I tried to migration using "refactor > migration to android x", but it shows error popup.
The error popup said to me use compilesdkversion at least 28.
But I already use 28.. what should I do?......
change gradle version from 3.2.1 to 3.3.2.
But build failed with different log
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
D8: Program type already present: android.support.v4.app.INotificationSideChannel
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.app.INotificationSideChannel
I don't know what should i do...
It make me to tired...
I just want to coding...
I resolve this issue following this link: https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility
There is 2 migration guide.
Recommended
Not Recommended
In my case, 'Recommended' solution doesn't work...
But, 'Not recommended' solution works...
...
It's not easy...
I tried this two lines of code
flutter clean and then
flutter run

react-native-i18n:processReleaseResources FAILED

I am new to React-Native and I am trying to use the Ignite boilerplate. I followed all the steps for building my first app but now I am stuck with and error and can't find the answer.
As the title says, the error is:
:react-native-i18n:processReleaseResources FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-i18n:processReleaseResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
I am using version 0.50.4 of react-native and version 2.0.1 of react-native-cli, and running on Ubuntu.
Anyone knows what the problem could be?

Error when include path_provider

I get an error when I'm trying to compile path_provider:
/home/user/projects/flutterframework/TestApp/android/app/src/main/java/io/flutter/plugins/PluginRegistry.java:15:
error: cannot find symbol
path_provider = PathProviderPlugin.register(activity);
symbol: method register(FlutterActivity)
location: class PathProviderPlugin
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.
How can I fix it?
Lubuntu 16 LTS x64
It sounds like you have an old project template. You shouldn't have a PluginRegistry.java. Try flutter upgrade, recreate your project and copy the old project's dart files and assets over.

React-native android issues with Windows 10

I am running react-native on windows 10 and I'm having a bunch of issues.
Firstly, at the root directory of the project, when I run
react-native run-android
I get this error:
JS server already running. Building and installing the app on the
device (cd android && gradlew.bat installDebug... 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/android-setup.html
And running it with --stacktrace --info did not help.
I then decided to manually do what the run-android script seems to be trying to achieve by going into the android directory and build my self by running
cd android && gradlew.bat installDebug
That, produced a bunch of result but still ended in error.
:app:compileDebugJavaWithJavac :app:compileDebugJavaWithJavac - is not
incremental (e.g. outputs have changed, no previous execution, etc.).
C:\Users\jiangyaokai\workspace\maincourse\android\app\src\main\java\com\maincourse\MainApplication.java:30:
error: cannot find symbol
new CodePush(this.getResources().getString(R.strings.reactNativeCodePush_androidDeploymentKey),
this, BuildConfig.DEBUG),
^ symbol: variable strings location: class R
C:\Users\jiangyaokai\workspace\maincourse\android\app\src\main\java\com\maincourse\MainApplication.java:30:
error: cannot find symbol
new CodePush(this.getResources().getString(R.strings.reactNativeCodePush_androidDeploymentKey),
this, BuildConfig.DEBUG),
^ symbol: method getResources()
2 errors :app:compileDebugJavaWithJavac FAILED
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.
BUILD FAILED
Total time: 8.109 secs
I wonder what I am doing wrong? Thanks.
Here's a snippet from your error message:
MainApplication.java:30: error: cannot find symbol new CodePush(this.getResources().getString(R.strings.reactNativeCodePush_androidDeploymentKey), this, BuildConfig.DEBUG), ^ symbol: method getResources()
it looks like it has something to do with CodePush plugin that you are using.
Could you follow the setup instruction here: https://github.com/Microsoft/react-native-code-push#android-setup and try again.
Solved.
symbol: variable strings location: class R
this is caused by the fact that R only has string but not strings, not sure why the code (auto generated) refers to strings.
symbol: method getResources()
This is missing because "this" refers to the inner class, wheres getResources() is only found in the outer class.
Overall, basically the code was wrong and correctly could not be compiled.
Thanks to all.

Categories

Resources