react-native run-android has error, How to fix it? - android

I want run my first react native project, I use linux and i want run android project.
I install lastest version of android studio and install android SDK and I export PATH in shell config.
I create project with react-native init albums and open albums/android with android studio, android studio auto install gradle and it haven't error.
I create an AVD with android 4.0.3 and run it.
I want run my project with react-native run-android, but i get an error:
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
:app:checkDebugClasspath UP-TO-DATE
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugAidl NO-SOURCE
:app:compileDebugRenderscript UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:mainApkListPersistenceDebug UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:splitsDiscoveryTaskDebug UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:javaPreCompileDebug UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:copyDebugBundledJs SKIPPED
:app:transformClassesWithDexBuilderForDebug UP-TO-DATE
:app:transformDexArchiveWithExternalLibsDexMergerForDebug UP-TO-DATE
:app:transformDexArchiveWithDexMergerForDebug UP-TO-DATE
:app:compileDebugNdk NO-SOURCE
:app:mergeDebugJniLibFolders UP-TO-DATE
:app:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
:app:checkDebugLibraries UP-TO-DATE
:app:processDebugJavaRes NO-SOURCE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateSigningDebug UP-TO-DATE
:app:packageDebug UP-TO-DATE
:app:installDebug
Skipping device 'Nexus_5X_API_15(AVD) - 4.0.4' for 'app:debug': minSdkVersion [16] > deviceApiLevel [15]
:app:installDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> Failed to install on any devices.
* 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 6s
28 actionable tasks: 1 executed, 27 up-to-date
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/getting-started.html
How i can fix this error?

The problem is that your app is targeting 16 API level of Android and you are trying to run it in a lesser API (15). Try changing the API level in the manifest but, I think that the lesser Android API is 16 if you want to run React Native Apps.

According to this page:
Supported target operating systems are >= Android 4.1 (API 16) ...
You are tying to build into a device with API 15. Not going to work.

Add the following method into your build.gradle (before the allprojects method)
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "28.0.0"
}
}
}
}
Change your react native version to 0.57.3 in package.json
And be happy

Related

React-Native run android error java is not incremential and react-native upgrade dismatch version with node_module

I just started my project with the init command create-react-native-app and I installed all prerequires.
I have some problems with the command react-native run-android I got this error
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee081Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore081Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco081Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline081Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp081Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0201Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
I tried to search about it and people are talking about upgrading react-native but when I try to "react-native-git-upgrade" i got an error with version of my "package.json".
git-upgrade info Check for updates
git-upgrade info Read package.json files
git-upgrade info Check declared version
git-upgrade info Check matching versions
git-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: react-native version in "package.json" (https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz) doesn't match the installed version in "node_modules" (0.55.4).
Try running "npm install" to fix this.
at checkMatchingVersions (/usr/local/lib/node_modules/react-native-git-upgrade/checks.js:24:11)
at Object.<anonymous> (/usr/local/lib/node_modules/react-native-git-upgrade/cliEntry.js:253:5)
at Generator.next (<anonymous>)
at step (/usr/local/lib/node_modules/react-native-git-upgrade/cliEntry.js:171:191)
at /usr/local/lib/node_modules/react-native-git-upgrade/cliEntry.js:171:361
at tryCallOne (/usr/local/lib/node_modules/react-native-git-upgrade/node_modules/promise/lib/core.js:37:12)
at /usr/local/lib/node_modules/react-native-git-upgrade/node_modules/promise/lib/core.js:123:15
at flush (/usr/local/lib/node_modules/react-native-git-upgrade/node_modules/asap/raw.js:50:29)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
When I do npm install nothing change, I tried to delete my node_modules directory and create new one with npm install but it doesn't change.
I'm on Ubuntu and I'm struggling with this since few days ...
I think these steps will help you.
Go to your project directory and run this command [Ubuntu: cd
android && ./gradlew clean]
Delete build folder from android directory, assuming you are in android directory [rm -rf build in Ubuntu]
If this steps doesn’t produce any result then follow steps [1,2]
and then remove node_modules directory and run npm install after
following [1,2] from the root directory of your project .
Finally, go with this command react-native run-android from project root.

Android Studio Gradle build error- Task :app:packageInstantRunResourcesDebug FAILED

I am new to android studio and Gradle. I have a project where I am loading a large SQLite database (from assets folder). When I press run and select an emulator, android studio starts on the build and executes gradle tasks. I am getting an error on one of these tasks which says:
Error:Execution failed for task ':app:packageInstantRunResourcesDebug'.
> org.gradle.tooling.BuildException (no error message)
and in the complete error output in console it says this:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageInstantRunResourcesDebug'.
> org.gradle.tooling.BuildException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or
--debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 21s
I don't know if this is due to the large database. This is the stack trace of the tasks being built:
Executing tasks: [:app:assembleDebug]
:app:buildInfoDebugLoader
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:splitsDiscoveryTaskDebug UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources
:app:javaPreCompileDebug UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:packageInstantRunResourcesDebug FAILED
:app:buildInfoGeneratorDebug
You need to disable Instant Run feature. Instruction for latest stable Android Studio:
File -> Settings -> Build, Execution, Deployment -> Instant Run -> [Remove checkbox] ""Enable Instant Run to hot sap code...""

ionic native fcm plugin issue

I want to implement firebase push notification in my ionic 3 application. I've added ionic natice fcm plugin. But when i build application using following command
ionic cordova build android
but it gives me an error as below:
ionic cordova build android
Running app-scripts build: --iscordovaserve --externalIpRequired --nobrowser
[12:22:34] build dev started ...
[12:22:34] clean started ...
[12:22:34] clean finished in 31 ms
[12:22:34] copy started ...
[12:22:34] transpile started ...
[12:22:52] transpile finished in 17.82 s
[12:22:52] preprocess started ...
[12:22:52] deeplinks started ...
[12:22:52] deeplinks finished in 250 ms
[12:22:52] preprocess finished in 297 ms
[12:22:52] webpack started ...
[12:22:55] copy finished in 20.24 s
[12:23:15] webpack finished in 22.49 s
[12:23:15] sass started ...
[12:23:19] sass finished in 4.08 s
[12:23:19] postprocess started ...
[12:23:19] postprocess finished in 32 ms
[12:23:19] lint started ...
[12:23:19] build dev finished in 44.83 s
> cordova build android
✖ Running command - failed!
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova build android (exit code 1):
(truncated) ... aLib:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE
:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:preReleaseBuild UP-TO-DATE
:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseShaders UP-TO-DATE
:CordovaLib:compileReleaseShaders UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources UP-TO-DATE
:CordovaLib:processReleaseManifest UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig UP-TO-DATE
:CordovaLib:processReleaseResources UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:CordovaLib:compileReleaseJavaWithJavac UP-TO-DATE
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:CordovaLib:mergeReleaseJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:CordovaLib:bundleRelease UP-TO-DATE
:prepareComAndroidSupportSupportCompat2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUi2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUtils2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportFragment2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportMediaCompat2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportV42600Alpha1Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesAds900Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesAdsLite900Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBase900Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBasement1102Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesTasks1102Library UP-TO-DATE
:prepareComGoogleFirebaseFirebaseAnalytics1102Library UP-TO-DATE
:prepareComGoogleFirebaseFirebaseAnalyticsImpl1102Library UP-TO-DATE
:prepareComGoogleFirebaseFirebaseCommon1102Library UP-TO-DATE
:prepareComGoogleFirebaseFirebaseCore1102Library UP-TO-DATE
:prepareComGoogleFirebaseFirebaseIid1102Library UP-TO-DATE
:prepareComGoogleFirebaseFirebaseMessaging1102Library UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript
:generateDebugBuildConfig UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:processDebugGoogleServices
Parsing json file: D:\Projects\Code\Other\DailySheet\DailySheetMobileApp\platforms\android\google-services.json
:generateDebugResources
:mergeDebugResources
:processDebugManifest UP-TO-DATE
:processDebugResources
:generateDebugSources
:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:compileDebugJavaWithJavac UP-TO-DATE
:compileDebugNdk UP-TO-DATE
:compileDebugSources UP-TO-DATE
:mergeDebugShaders UP-TO-DATE
:compileDebugShaders
:generateDebugAssets
:mergeDebugAssets UP-TO-DATE
:transformClassesWithDexForDebug FAILED
BUILD FAILED
Total time: 1 mins 48.75 secs
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define
Lcom/google/android/gms/internal/zzee;
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define
Lcom/google/android/gms/internal/zzee;
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
It was all working fine before i added FCM plugin. My project information is as below:
global packages:
#ionic/cli-utils : 1.4.0
Cordova CLI : 6.5.0
Ionic CLI : 3.4.0
local packages:
#ionic/app-scripts : 1.3.12
#ionic/cli-plugin-cordova : 1.4.0
#ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms : android 6.1.2
Ionic Framework : ionic-angular 3.5.0
System:
Node : v7.8.0
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 4.2.0
Also i tried to remove all plugins and platform and readded it. But no solution! :(
Solution found here: https://forum.ionicframework.com/t/ionic-native-fcm-plugin-issue/96601/6
Finally, i found solution, here what i’ve done: Replace
android.gms:play-services-ads with firebase:firebase-ads in below
files:
build.gradle project.properties plugin.xml Also check that if any
version is provided after android.gms:play-services-ads:X.X.X, then
replace it with android.gms:play-services-ads:+
Before adding the Ionic native FCM plugin to your app, you need to configure your app on google firebase console and add to GoogleService-info.plist & google-services.json in your app's root folder.
Try removing the plugin, adding the files and then re-adding the plugin again.

Ionic Failed - Android Build

This is the output I get
ionic cordova build android --stacktrace
> cordova build android
✖ Running command - failed!
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova build android (exit code 1):
(truncated) ... ld UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources UP-TO-DATE
:CordovaLib:compileReleaseAidl UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig UP-TO-DATE
:CordovaLib:mergeReleaseShaders UP-TO-DATE
:CordovaLib:compileReleaseShaders UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:CordovaLib:processReleaseManifest UP-TO-DATE
:CordovaLib:processReleaseResources UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:CordovaLib:compileReleaseJavaWithJavac UP-TO-DATE
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:CordovaLib:mergeReleaseJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:CordovaLib:bundleRelease UP-TO-DATE
:prepareComAndroidSupportSupportCompat2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUi2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUtils2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportFragment2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportMediaCompat2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportV42600Alpha1Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesAds1026Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesAdsLite1026Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBase1026Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBasement1026Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesClearcut1026Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesGass1026Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesTasks1026Library UP-TO-DATE
:prepareOrgXwalkXwalk_core_library22525614Library UP-TO-DATE
:prepareArmv7DebugDependencies
:compileArmv7DebugAidl UP-TO-DATE
:compileArmv7DebugRenderscript
:generateArmv7DebugBuildConfig UP-TO-DATE
:mergeArmv7DebugShaders UP-TO-DATE
:compileArmv7DebugShaders UP-TO-DATE
:generateArmv7DebugAssets UP-TO-DATE
:mergeArmv7DebugAssets UP-TO-DATE
:createXwalkCommandLineFileArmv7Debug
:generateArmv7DebugResValues UP-TO-DATE
:generateArmv7DebugResources
:mergeArmv7DebugResources
:processArmv7DebugManifest
:processArmv7DebugResources
:generateArmv7DebugSources
:incrementalArmv7DebugJavaCompilationSafeguard UP-TO-DATE
:compileArmv7DebugJavaWithJavac UP-TO-DATE
:compileArmv7DebugNdk UP-TO-DATE
:compileArmv7DebugSources UP-TO-DATE
:prePackageMarkerForArmv7Debug
:transformClassesWithDexForArmv7Debug UP-TO-DATE
:mergeArmv7DebugJniLibFolders UP-TO-DATE
:transformNative_libsWithMergeJniLibsForArmv7Debug UP-TO-DATE
:processArmv7DebugJavaRes UP-TO-DATE
:transformResourcesWithMergeJavaResForArmv7Debug FAILED
BUILD FAILED
Total time: 40.152 secs
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformResourcesWithMergeJavaResForArmv7Debug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.squareup.okhttp3/okhttp/pom.properties
File1: C:\Users\A2\.gradle\caches\modules-2\files-2.1\com.squareup.okhttp3\okhttp\3.8.0\5a11f020cce2d11eb71ba916700600e18c4547e7\okhttp-3.8.0.jar
File2: C:\Users\A2\Desktop\posApAp\posApp\platforms\android\build\intermediates\exploded-aar\com.google.android.gms\play-services-basement\10.2.6\jars\classes.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformResourcesWithMergeJavaResForArmv7Debug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.squareup.okhttp3/okhttp/pom.properties
File1: C:\Users\A2\.gradle\caches\modules-2\files-2.1\com.squareup.okhttp3\okhttp\3.8.0\5a11f020cce2d11eb71ba916700600e18c4547e7\okhttp-3.8.0.jar
File2: C:\Users\A2\Desktop\posApAp\posApp\platforms\android\build\intermediates\exploded-aar\com.google.android.gms\play-services-basement\10.2.6\jars\classes.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Can somebody please let me know how to sort this issue? Thank you.
It says Duplicate class copied. How to solve this issue. I tried exclude in build.gradle but it's not helping.
I encountered same issue while building my app and I solved it by
Update android SDK
Remove platform using proper command
ionic cordova platform remove android (if you are using latest CLI)
then add android platform again and build it.
if it still dont work, try downgrading nodejs to previous version and build.
Solved the question.
I needed to do exclude META-INF

Android Studio AVD is not launching

Hi I have installed the latest version of Android Studio on Windows 7 32-bit.
I have created a welcome app, but when I try to test it using AVD it's not launching, instead it's showing the error below:
Executing tasks: [:app:assembleDebug, :app:assembleDebugTest]
Configuration on demand is an incubating feature.
:app:preBuild
:app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72102Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42102Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources
:app:generateDebugSources
:app:compileDebugJava
:app:preDexDebug
The system cannot find the path specified.
The system cannot find the path specified.
FAILED
The system cannot find the path specified.
The system cannot find the path specified.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
E:\Android\AndroidStudio\sdk\build-tools\21.1.1\dx.bat --dex --output E:\Android\AndroidStudio\WorkLocation\MyApplication\app\build\intermediates\pre-dexed\debug\classes-0f52de9bbc91bb9956813aaf2c6f0ff9d0160fa0.jar E:\Android\AndroidStudio\WorkLocation\MyApplication\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.2\classes.jar
Error Code: 1
Output: The system cannot find the path 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: 24.154 secs
**Failed to complete Gradle execution
Cause:**
Does anyone know how to fix this?

Categories

Resources