I'm creating a React native project. But when I enter the npx react-native run-android command, I get the following error.
> Task :app:compileDebugJavaWithJavac FAILED
18 actionable tasks: 18 executed
/Users/Cans/Desktop/react-egitimi/introduction/loginPageProject/android/app/src/main/java/com/loginapp/MainApplication.java:19: error: cannot find symbol
return BuildConfig.DEBUG;
^
symbol: variable BuildConfig
Note: /Users/Cans/Desktop/react-egitimi/introduction/loginPageProject/android/app/src/debug/java/com/loginpageproject/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
FAILURE: Build failed with an exception.
* Get more help at https://help.gradle.org
BUİLD FAILED in 18s
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/Cans/Desktop/react-egitimi/introduction/loginPageProject/android/app/src/main/java/com/loginapp/MainApplication.java:19: error: cannot find symbol
return BuildConfig.DEBUG;
^
symbol: variable BuildConfig
Note: /Users/Cans/Desktop/react-egitimi/introduction/loginPageProject/android/app/src/debug/java/com/loginpageproject/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
FAILURE: Build failed with an exception.
I tried deleting gradle but it gives the same result again. what is the solution?
Related
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
this error randomly popped up after i tried running my ionic cordova app. this not only happens on my branch ive been working on but also with every other branch i try to run, which leads me to believe it is something with my machine. ive tried restarting and reinstalling the packages and it hasnt solved the issue.
> ionic-app-scripts.cmd build --target cordova --platform android
[23:25:18] ionic-app-scripts 3.2.4
[23:25:18] build dev started ...
[23:25:18] clean started ...
[23:25:18] clean finished in 21 ms
[23:25:18] copy started ...
[23:25:18] deeplinks started ...
[23:25:18] deeplinks finished in 515 ms
[23:25:18] transpile started ...
[23:25:25] transpile finished in 6.59 s
[23:25:25] preprocess started ...
[23:25:25] preprocess finished in less than 1 ms
[23:25:25] webpack started ...
[23:25:25] copy finished in 7.26 s
[23:25:30] webpack finished in 5.09 s
[23:25:30] sass started ...
[23:25:32] sass finished in 1.82 s
[23:25:32] postprocess started ...
[23:25:32] postprocess finished in 14 ms
[23:25:32] lint started ...
[23:25:32] build dev finished in 14.19 s
no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
[23:25:36] lint finished in 4.22 s
> cordova.cmd build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
Using Android SDK: C:\Users\IvanTzenev\AppData\Local\Android\sdk
Subproject Path: CordovaLib
Subproject Path: app
> Task :app:compileDebugJavaWithJavac FAILED
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\com\ionicframework\cordova\webview\IonicWebViewEngine.java:11: error: package android.support.annotation does not exist
import android.support.annotation.RequiresApi;
^
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\cordova\plugins\Diagnostic.java:57: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
^
symbol: class ActivityCompat
location: package android.support.v4.app
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\cordova\plugins\Diagnostic_External_Storage.java:28: error: cannot find symbol
import android.support.v4.os.EnvironmentCompat;
^
symbol: class EnvironmentCompat
location: package android.support.v4.os
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\cordova\plugins\Diagnostic_Notifications.java:35: error: cannot find symbol
import android.support.v4.app.NotificationManagerCompat;
^
symbol: class NotificationManagerCompat
location: package android.support.v4.app
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\org\apache\cordova\camera\CameraLauncher.java:40: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
^
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\org\apache\cordova\camera\CordovaUri.java:25: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
^
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\org\apache\cordova\camera\FileProvider.java:21: error: package android.support.v4.content does not exist
public class FileProvider extends android.support.v4.content.FileProvider {}
^
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\com\ionicframework\cordova\webview\IonicWebViewEngine.java:137: error: cannot find symbol
#RequiresApi(Build.VERSION_CODES.LOLLIPOP)
^
symbol: class RequiresApi
location: class IonicWebViewEngine.ServerClient
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\cordova\plugins\Diagnostic.java:648: error: cannot find symbol
java.lang.reflect.Method method = ActivityCompat.class.getMethod("shouldShowRequestPermissionRationale", Activity.class, java.lang.String.class);
^
symbol: class ActivityCompat
location: class Diagnostic
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\cordova\plugins\Diagnostic_External_Storage.java:216: error: cannot find symbol
addPath = Environment.MEDIA_MOUNTED.equals(EnvironmentCompat.getStorageState(file));
^
symbol: variable EnvironmentCompat
location: class Diagnostic_External_Storage
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\cordova\plugins\Diagnostic_Notifications.java:123: error: cannot find symbol
NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(this.cordova.getActivity().getApplicationContext());
^
symbol: class NotificationManagerCompat
location: class Diagnostic_Notifications
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\cordova\plugins\Diagnostic_Notifications.java:123: error: cannot find symbol
NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(this.cordova.getActivity().getApplicationContext());
^
symbol: variable NotificationManagerCompat
location: class Diagnostic_Notifications
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\org\apache\cordova\camera\CameraLauncher.java:303: error: cannot find symbol
this.imageUri = new CordovaUri(FileProvider.getUriForFile(cordova.getActivity(),
^
symbol: method getUriForFile(Activity,String,File)
location: class FileProvider
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\org\apache\cordova\camera\CameraLauncher.java:801: error: cannot find symbol
Uri tmpFile = FileProvider.getUriForFile(cordova.getActivity(),
^
symbol: method getUriForFile(Activity,String,File)
location: class FileProvider
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.
14 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.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s
21 actionable tasks: 1 executed, 20 up-to-date
Command failed with exit code 1: C:\GitHub\Accentis-Ionic\platforms\android\gradlew cdvBuildDebug -b C:\GitHub\Accentis-Ionic\platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
i think you are missing these v4 libraries or dependencies are not getting sync properly. first thing you can invalidate/restart(file menu in Android studio) your project and if still not working then can check below link: package android.support.v4.app does not exist ; in Android studio 0.8
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.
I cannot build after updating flutter and andriodX. I keep gettng the error below with a lots of warning messages. I upgraged flutter. I also executed flutter doctor. It has not helped.
The app was working fine and in order to user Firebase authentication,I created SHA1. After that it stopped working. Please suggest. I have looked over all other similar questions but I can't seem to find a solution.
Note: C:\Users\username\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_core_web-0.1.1+2\android\src\main\java\io\flutter\plugins\firebase_core_web\FirebaseCoreWebPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\Users\username\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences-0.5.7+3\android\src\main\java\io\flutter\plugins\sharedpreferences\SharedPreferencesPlugin.java:18: warning: [deprecation] Registrar in PluginRegistry has been deprecated
public static void registerWith(PluginRegistry.Registrar registrar) { ^
1 warning
C:\Users\username\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\webview_flutter-2.0.6\android\src\main\java\io\flutter\plugins\webviewflutter\InputAwareWebView.java:31: error: cannot find symbol
private ThreadedInputConnectionProxyAdapterView proxyAdapterView;
^
symbol: class ThreadedInputConnectionProxyAdapterView
location: class InputAwareWebView
C:\Users\username\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\webview_flutter-2.0.6\android\src\main\java\io\flutter\plugins\webviewflutter\InputAwareWebView.java:112: error: cannot find symbol
new ThreadedInputConnectionProxyAdapterView(
^
symbol: class ThreadedInputConnectionProxyAdapterView
location: class InputAwareWebView
Note: Some input files use or override 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 ':webview_flutter:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
BUILD FAILED in 2m 22s
Exception: Gradle task assembleDebug failed with exit code 1
gradle.properties
android.useAndroidX=true
android.enableJetifier=true
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.