Error while running react-native app please help me - android

WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.5.2.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '23.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Task :app:processDebugResources 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.9/userguide/command_line_interface.html#sec:command_line_warnings
234 actionable tasks: 14 executed, 220 up-to-date
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
C:\coding\App\storyqube-frontend\android\app\src\main\AndroidManifest.xml:13:5-71:19: AAPT: error: resource mipmap/storyqube (aka com.storyqube:mipmap/storyqube) not found.
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 18s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
C:\coding\App\storyqube-frontend\android\app\src\main\AndroidManifest.xml:13:5-71:19: AAPT: error: resource mipmap/storyqube (aka com.storyqube:mipmap/storyqube) not found.
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 18s
at makeError (C:\coding\App\storyqube-frontend\node_modules\execa\index.js:174:9)
at C:\coding\App\storyqube-frontend\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\coding\App\storyqube-frontend\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\coding\App\storyqube-frontend\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
PS C:\coding\App\storyqube-frontend>

Check your build.gradle files in your android folder and search for compile and replace it it with implementation.
Change:
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile project(':react-native-sqlite-storage')
}
To:
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:23.0.1"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-sqlite-storage')
}

Related

Flutter Onesignal Could not resolve com.google.firebase:firebase-messaging

I'm trying to run my flutter application after added onesignal_flutter: ^3.2.8 on my pubspec.yaml. I got this error:
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not resolve com.google.firebase:firebase-messaging:{require [19.0.0, 22.0.99]; prefer 22.0.0}.
Required by:
project :app > project :onesignal_flutter > com.onesignal:OneSignal:4.6.6
> Failed to list versions for com.google.firebase:firebase-messaging.
> Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/firebase/firebase-messaging/maven-metadata.xml.
> Could not get resource 'https://google.bintray.com/exoplayer/com/google/firebase/firebase-messaging/maven-metadata.xml'.
> Could not GET 'https://google.bintray.com/exoplayer/com/google/firebase/firebase-messaging/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
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 2m 47s
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
Exception: Gradle task assembleDebug failed with exit code 1```
Add the following lines to your android/app/build.gradle
buildscript {
repositories {
// ...
mavenCentral()
}
dependencies {
// ...
// OneSignal-Gradle-Plugin
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
You can also refer to One Signal documentation for more info.

Can't use ConstraintLayout! Error: AAPT2 error: check logs for details

I want to use ConstraintLayout recently. But it seems to be more complicated than I can imagine. When I add the dependency, compile error comes as below:
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
When I execute gradlew assemble, I get this:
AGPBI: {"kind":"error","text":"error: duplicate value for resource \u0027attr/content\u0027 with config \u0027\u0027.","sources":[{"file":"D:\\Cache\\.gradle\\caches\\transforms-1\\files-1.1\\appcompat-v7-27.1.1.aar\\b4523fa2ae32c684fd710140c71c62d6\\res\\values\\values.xml","position":{"startLine":250,"startColumn":4,"startOffset":27058,"endColumn":68,"endOffset":27122}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: resource previously defined here.","sources":[{"file":"D:\\Cache\\.gradle\\caches\\transforms-1\\files-1.1\\appcompat-v7-27.1.1.aar\\b4523fa2ae32c684fd710140c71c62d6\\res\\values\\values.xml","position":{"startLine":250,"startColumn":4,"startOffset":27058,"endColumn":68,"endOffset":27122}}],"original":"","tool":"AAPT"}
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs 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
Here is my build.gradle file:
...
repositories {
google()
}
...
dependencies {
def app = rootProject.ext.android
// android support
implementation "com.android.support:appcompat-v7:27.1.1"
implementation "com.android.support:design:27.1.1"
implementation "com.android.support:palette-v7:27.1.1"
implementation "com.android.support:recyclerview-v7:27.1.1"
implementation "com.android.support:cardview-v7:27.1.1"
implementation "com.android.support:percent:27.1.1"
implementation "com.android.support:support-v4:27.1.1"
implementation "com.android.support:gridlayout-v7:27.1.1"
implementation "com.android.support:support-vector-drawable:27.1.1"
implementation 'com.android.support:multidex:1.0.3'
implementation 'junit:junit:4.12'
implementation "android.arch.lifecycle:extensions:1.1.1"
...
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}
I had tried to clean, rebuild, invalidate and restart. They didn't work. And I also tried to update gradle plugin. But I saw more errors. Somebody help me please! It has bothered me for a couple of days.
PS, Information you may need:
Windows 7
android studio 3.3.2
gradle 3.1.4
java 8

Could not get unknown property 'FCM_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler

I am setting up an Android project in Android Studio with Cordova.
I have the following in my dependencies (\platforms\android\build.gradle):
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
debugCompile(project(path: "CordovaLib", configuration: "debug"))
releaseCompile(project(path: "CordovaLib", configuration: "release"))
compile "com.android.support:support-v13:26.+"
compile "me.leolin:ShortcutBadger:1.1.17#aar"
compile "com.google.firebase:firebase-messaging:$FCM_VERSION"
// SUB-PROJECT DEPENDENCIES END
}
When I try to run cordova build android I get the following error:
Could not get unknown property 'FCM_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler
In my config.xml in the root of my project I have the following where theat variable is declared:
<plugin name="phonegap-plugin-push" spec="^2.1.3">
<variable name="FCM_VERSION" value="11.6.2" />
</plugin>
Full error message in terminal:
ANDROID_HOME=C:\Users\Shabaz\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
Subproject Path: CordovaLib
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\Shabaz\AppData\Local\Android\Sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_20908j486irej0tvcnl5l4x1o.run(C:\wamp\www\acm-waste-track-cordova\platforms\android\build.gradle:142)
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\wamp\www\acm-waste-track-cordova\platforms\android\build.gradle' line: 259
* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not get unknown property 'FCM_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* 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: 1.931 secs
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\wamp\www\acm-waste-track-cordova\platforms\android\build.gradle' line: 259
* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not get unknown property 'FCM_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Anyone know whats going on here?

Travis CI build failed, Could not resolve all files for configuration

I suddenly experience build failure with TRAVIS CI builds. But build succeeded with my local project. And the code has never been changed.
The link below shows error. {"errors": [{"status": 404,"message": "Could not find resource"}]}
:library:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
:myapp:dataBindingExportBuildInfoDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong: Could not resolve all files for configuration
':hwahae:debugCompileClasspath'.
> Could not find firebase-core.jar
(com.google.firebase:firebase-core:12.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/google/firebase/firebase-core/12.0.1/firebase-core-12.0.1.jar
> Could not find play-services-ads.jar
(com.google.android.gms:play-services-ads:12.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-ads/12.0.1/play-services-ads-12.0.1.jar
> Could not find play-services-auth.jar
(com.google.android.gms:play-services-auth:12.0.1). Searched in the
following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-auth/12.0.1/play-services-auth-12.0.1.jar
* 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 29s 64
actionable tasks: 16 executed, 48 up-to-date
myapp.gradle
dependencies {
def firebase_version 12.0.1
implementation "com.google.firebase:firebase-core:$firebase_version"
implementation "com.google.firebase:firebase-invites:$firebase_version"
implementation "com.google.firebase:firebase-config:$firebase_version"
def google_service_version = '12.0.1'
implementation "com.google.android.gms:play-services-gcm:$google_service_version"
implementation "com.google.android.gms:play-services-analytics:$google_service_version"
implementation "com.google.android.gms:play-services-ads:$google_service_version"
implementation "com.google.android.gms:play-services-auth:$google_service_version"
}

android studio cant build

FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:preDexDebug'.
java.io.IOException: Cannot run program "C:\Users\SETIAWAN\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat":
CreateProcess error=2, The system cannot find the file specified
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: 1 mins 12.109 secs
Anyone can help. When I try to run dx.bat. Error Windows can't find this file(dx.bat)
You may adding android-support-v4.jar for multiple times. Remove the dependencies of android-support-v4.jar from project's build.gradle and just have a single dependencies, such that:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}

Categories

Resources