So I'm getting an error (at the bottom) that's most likely caused by me trying uninstalling react-native-pathjs-charts. The problem below only exists on android and not on ios.
Error:
/Users/a.lau/Projects/react-native/First_App/android/app/src/main/java/com/first_app/MainApplication.java:7: error: cannot find symbol
import com.horcrux.svg.RNSvgPackage;
^
symbol: class RNSvgPackage
location: package com.horcrux.svg
/Users/a.lau/Projects/react-native/First_App/android/app/src/main/java/com/first_app/MainApplication.java:29: error: cannot find symbol
new RNSvgPackage()
^
symbol: class RNSvgPackage
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: 5.997 secs
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
Also have in mind that the package was changed from:
import com.horcrux.svg.RNSvgPackage;
to
import com.horcrux.svg.SvgPackage;
so you have to change from new RNSvgPackage() to new SvgPackage()
hope it helps!
I guess you did not unlink before uninstalling the module. Install again, unlink and then uninstall the module.
npm install react-native-pathjs-charts --save
react-native unlink react-native-svg
npm remove react-native-pathjs-charts --save
Run with yarn add package_name is helped me.
Related
I'm not sure what I've changed, but I can no longer get my app running on android devices. Running npx react-native run-android --deviceId abcdefg123 results in the following errors:
info Done writing bundle output
info Done writing sourcemap output
info Copying 47 asset files
info Done copying assets
> Task :react-native-reanimated:androidJavadoc FAILED
/Users/[....]/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java:5: error: package com.facebook.react.bridge does not exist
import com.facebook.react.bridge.Arguments;
^
/Users/[....]/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java:6: error: package com.facebook.react.bridge does not exist
import com.facebook.react.bridge.Callback;
^
/Users/[....]/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java:7: error: package com.facebook.react.bridge does not exist
import com.facebook.react.bridge.GuardedRunnable;
^
/Users/[....]/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java:8: error: package com.facebook.react.bridge does not exist
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
...plus loads more similar errors, then...
100 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-reanimated:androidJavadoc'.
> Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '/Users/[....]/node_modules/react-native-reanimated/android/build/tmp/androidJavadoc/javadoc.options'
* 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.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1m 33s
2342 actionable tasks: 6 executed, 2336 up-to-date
error Failed to build the app. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew build -x lint
at makeError (/Users/[....]/node_modules/execa/index.js:174:9)
error Command failed with exit code 1.
I've been going in circles for a day now, trying to figure it out but I keep coming back to this error. Any ideas what I've done wrong, or what to try next?
Update:
If I remove the --deviceId flag, the app will run on the android emulator just fine. And it also works if I plug in a Samsung device I have.
When I plug in another device (Mi Max 2), I'm now getting a different error - see this post
However, the react-native-reanimated:androidJavadoc error described above still persists for both devices when I attempt to target either of them directly with the deviceId flag.
I was able to solve this issue, by following the installation guide of React-native-reanimated.
First install :
yarn add react-native-reanimated#next
Turn on Hermes engine by editing android/app/build.gradle :
project.ext.react = [
enableHermes: true // <- here | clean and rebuild if changing
]
Plug Reanimated in MainApplication.java
import com.facebook.react.bridge.JSIModulePackage; // <- add
import com.swmansion.reanimated.ReanimatedJSIModulePackage; // <- add
...
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
...
#Override
protected String getJSMainModuleName() {
return "index";
}
#Override
protected JSIModulePackage getJSIModulePackage() {
return new ReanimatedJSIModulePackage(); // <- add
}
};
...
Then clean your project and Build using ./gradlew clean and ./gradlew build in android folder of your project.
https://docs.swmansion.com/react-native-reanimated/docs/installation
I want to use local_auth plugin in flutter, and it needs Android lifecycle, so i installed flutter_plugin_android_lifecycle, but i get this error with it if i try to release apk: error:
package androidx.lifecycle does not exist. I tried a lot of things, but i just cannot get it to work.
'''
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-1.0.7\android\src\main\java\io\flutter\embedding\engine\plugins\lifecycle\FlutterLifecycleAdapter.java:8: error:
package androidx.lifecycle does not exist
import androidx.lifecycle.Lifecycle;
^
C:\flutter.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-1.0.7\android\src\main\java\io\flutter\embedding\engine\plugins\lifecycle\FlutterLifecycleAdapter.java:22: error:
cannot find symbol
public static Lifecycle getActivityLifecycle(
^
symbol: class Lifecycle
location: class FlutterLifecycleAdapter
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
> 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
'''
Adding implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' in build.grable plugin folder will solve the issue.
Refer https://github.com/flutter/flutter/issues/60883 for more details.
Add this in you flutter yaml dependencies
flutter_plugin_android_lifecycle: ^1.0.11
For more can visit : https://pub.dev/packages/flutter_plugin_android_lifecycle/install
This can be also due to a version gradle problem, so try to use these compatible versions in your /android/build.gradle
classpath 'com.android.tools.build:gradle:3.5.4'
you can try also:
3.3.3
3.4.3
3.5.4
3.6.4
4.0.1
This error came to me using the flutter plugin file_picker.
I hope this work.
I'm beginner for flutter. After coding something I want to simulate codes for Android emulator. I could run successfully a few days ago but today I can't. Error code says unable to find package java.lang. I didn't find where I should look for find problem. SDK path is correct, flutter doctor didn't find any problem. Also I can run project with iOS emulator. I am working on MacOS. Here whole error information.
Fatal Error: Unable to find package java.lang in classpath or bootclasspath
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':location: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 7s
Gradle task assembleDebug failed with exit code 1
You may want to run with verbose enabled, flutter run -v. Then you can find the possible error and warnings. It also happens when your code is incompatible to the gradle version. And the solution for it is to delete .gradle from your use home folder, then on next build flutter will redownload compatible gradle version. In case of Linux, rm -rf ~/.gradle.
Main problem is about packages. Some of them needs android migrate to androidx. When project migrated androidx, problem is solved.
Documentation
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.
I'm developing the cordova application, in which I want to have some kind of booking functionality through calendar. So for that, I installed very famous EddyVerbruggen/Calendar-PhoneGap-Plugin plugin.
But while building the project, it's throwing following error
/home/admin/Desktop/myApp/platforms/android/src/nl/xservices/plugins/Calendar.java:148: error: cannot find symbol
if (PackageManager.PERMISSION_GRANTED != ContextCompat.checkSelfPermission(this.cordova.getActivity(), type)) {
^
symbol: method checkSelfPermission(Activity,String)
location: class ContextCompat
/home/admin/Desktop/myApp/platforms/android/src/nl/xservices/plugins/Calendar.java:157: error: cannot find symbol
ActivityCompat.requestPermissions(
^
symbol: method requestPermissions(Activity,String[],int)
location: class ActivityCompat
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':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: 43.228 secs
Error: Error code 1 for command: /home/admin/Desktop/myApp/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/admin/Desktop/myApp/platforms/android/build.gradle,-PcdvBuildArch=x86,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
I also gone through following threads..but still no help
Android M (6) compatibility
Issue related to the new Cordova version CLI >5
My Environment
Cordova-CLI : 6.1.1
Android-Sdk : 23
So, what should I do to resolve this issue?
I had the same problem after updating my plugins. To save time, I just used an older version of the plugin.
ionic plugin add cordova-plugin-calendar#4.4.4