Compiling Component in React Native for Android - android

I am trying to port a functionality I have started and its working for React Native in iOS to Android.
The component is a Audio Sound waveform visualiser, which is working fine in iOS, but I'm finding an issue when I try to build the Android Studio project.
In the Gradle console it shows up:
Executing tasks: [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:assembleDebug]
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:app:clean
:app:buildInfoDebugLoader
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:ReactAndroid:preBuild UP-TO-DATE
:ReactAndroid:preReleaseBuild UP-TO-DATE
:ReactAndroid:checkReleaseManifest
:ReactAndroid:preReleaseUnitTestBuild UP-TO-DATE
:ReactAndroid:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:ReactAndroid:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:ReactAndroid:prepareComAndroidSupportSupportV42321Library UP-TO-DATE
:ReactAndroid:prepareComFacebookFrescoDrawee0110Library UP-TO-DATE
:ReactAndroid:prepareComFacebookFrescoFbcore0110Library UP-TO-DATE
:ReactAndroid:prepareComFacebookFrescoFresco0110Library UP-TO-DATE
:ReactAndroid:prepareComFacebookFrescoImagepipeline0110Library UP-TO-DATE
:ReactAndroid:prepareComFacebookFrescoImagepipelineBase0110Library UP-TO-DATE
:ReactAndroid:prepareComFacebookFrescoImagepipelineOkhttp30110Library UP-TO-DATE
:ReactAndroid:prepareComFacebookSoloaderSoloader010Library UP-TO-DATE
:ReactAndroid:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:ReactAndroid:prepareReleaseDependencies
:ReactAndroid:compileReleaseAidl UP-TO-DATE
:ReactAndroid:compileReleaseNdk UP-TO-DATE
:ReactAndroid:compileLint UP-TO-DATE
:ReactAndroid:copyReleaseLint UP-TO-DATE
:ReactAndroid:compileReleaseRenderscript UP-TO-DATE
:ReactAndroid:generateReleaseBuildConfig UP-TO-DATE
:ReactAndroid:generateReleaseResValues UP-TO-DATE
:ReactAndroid:generateReleaseResources UP-TO-DATE
:ReactAndroid:mergeReleaseResources UP-TO-DATE
:ReactAndroid:processReleaseManifest UP-TO-DATE
:ReactAndroid:processReleaseResources UP-TO-DATE
:ReactAndroid:generateReleaseSources UP-TO-DATE
:ReactAndroid:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:ReactAndroid:createNativeDepsDirectories UP-TO-DATE
:ReactAndroid:downloadBoost FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ReactAndroid:downloadBoost'.
> Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory
* 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.945 secs
For some reason it crashes in the Gradle task when executing
:ReactAndroid:downloadBoost
I've checked the https link manually and I can download the zip perfectly, so it may be the issue somewhere else.
Any help will be really appreciated.

Related

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 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 on Mac OS X, Gradle complaining about org.bouncycastle.asn1.ASN1Primitive

Recently migrated (or still trying to) from Eclipse ADT to Android Studio, here's what Gradle says when I hit `Run' (full trace below):
* What went wrong:
Execution failed for task ':app:packageDebug'.
> class org.bouncycastle.asn1.ASN1Primitive overrides final method equals.(Ljava/lang/Object;)Z
I've seen: Android Studio Bouncy castle issue (newbie), Problems launching error in Android Studio when packageDebug at Max OS X and similar SO posts that all point out to a bouncy castle JAR (bcprov-jdk15on-1.48.jar) that should be removed from the classpath. However I have no such JAR file there and it, in fact, Gradle itself seems to download it because the only place where I found it was:
/Applications/Android Studio.app/Contents/gradle/m2repository/org/bouncycastle/bcprov-jdk15on/
Trying to delete the file there, Gradle complains that a referenced library is missing.
Just how do I fix this?
Complete trace:
Executing tasks: [:app:assembleDebug]
Configuration on demand is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library 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 UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:transformClassesWithJarMergingForDebug UP-TO-DATE
:app:collectDebugMultiDexComponents
:app:transformClassesWithMultidexlistForDebug UP-TO-DATE
:app:transformClassesWithDexForDebug UP-TO-DATE
:app:mergeDebugJniLibFolders UP-TO-DATE
:app:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageDebug'.
> class org.bouncycastle.asn1.ASN1Primitive overrides final method equals.(Ljava/lang/Object;)Z
* 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: 0.479 secs

Error: Execution failed for task ':app:preDexDebug'

i've just installed the latest version of Android Studio Bundle with SDK
but i couldn't run even its "hello world" default simple program and when ever i tried to run program it just keep saying Execution failed for task ':app:preDexDebug'.
and here is the complete gradle console log:
Executing tasks: [:app:assembleDebug]
Configuration on demand is an incubating feature. :app:preBuild
UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72211Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42211Library 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
UP-TO-DATE :app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE :app:generateDebugSources
UP-TO-DATE :app:processDebugJavaRes UP-TO-DATE :app:compileDebugJava
UP-TO-DATE :app:compileDebugNdk UP-TO-DATE :app:compileDebugSources
UP-TO-DATE :app:preDexDebug FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:preDexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command
'C:\Program Files\Java\jdk1.8.0_40\bin\java.exe'' finished with
non-zero exit value 1
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: 4.734 secs
i tried with jdk version 7 and jdk 8 (32bit-win8)
i know there are similar topic and questions but none of them counldn't solve my problem

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