Why does Gradle run tests twice? - android

If I run my tests by the usual way everything is fine.
The problem is when I run tests with help of gradle they are executed twice. I use grandle to separate execution of small and medium tests.
This is the data of gradle console:
Executing tasks: [connectedAndroidTest]
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preProductionDebugBuild UP-TO-DATE
:app:checkProductionDebugManifest
:app:preProductionDebugAndroidTestBuild UP-TO-DATE
:app:preProductionReleaseBuild UP-TO-DATE
:app:preUiTestDebugAndroidTestBuild UP-TO-DATE
:app:preUiTestDebugBuild UP-TO-DATE
:app:preUiTestReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2421Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72421Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2421Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCompat2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUi2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUtils2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportFragment2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportMediaCompat2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2421Library UP-TO-DATE
:app:preparePlDroidsonroidsGifAndroidGifDrawable123Library UP-TO-DATE
:app:prepareProductionDebugDependencies
:app:compileProductionDebugAidl UP-TO-DATE
:app:compileProductionDebugRenderscript UP-TO-DATE
:app:generateProductionDebugBuildConfig UP-TO-DATE
:app:generateProductionDebugResValues UP-TO-DATE
:app:generateProductionDebugResources UP-TO-DATE
:app:mergeProductionDebugResources UP-TO-DATE
:app:processProductionDebugManifest UP-TO-DATE
:app:processProductionDebugResources UP-TO-DATE
:app:generateProductionDebugSources UP-TO-DATE
:app:incrementalProductionDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileProductionDebugJavaWithJavac UP-TO-DATE
:app:compileProductionDebugNdk UP-TO-DATE
:app:compileProductionDebugSources UP-TO-DATE
:app:mergeProductionDebugShaders UP-TO-DATE
:app:compileProductionDebugShaders UP-TO-DATE
:app:generateProductionDebugAssets UP-TO-DATE
:app:mergeProductionDebugAssets UP-TO-DATE
:app:transformClassesWithDexForProductionDebug UP-TO-DATE
:app:mergeProductionDebugJniLibFolders UP-TO-DATE
:app:transformNative_libsWithMergeJniLibsForProductionDebug UP-TO-DATE
:app:processProductionDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForProductionDebug UP-TO-DATE
:app:validateSigningProductionDebug
:app:packageProductionDebug UP-TO-DATE
:app:assembleProductionDebug UP-TO-DATE
:app:prepareComAndroidSupportTestEspressoEspressoContrib222Library UP-TO-DATE
:app:prepareComAndroidSupportTestEspressoEspressoCore222Library UP-TO-DATE
:app:prepareComAndroidSupportTestEspressoEspressoIdlingResource222Library UP-TO-DATE
:app:prepareComAndroidSupportTestEspressoEspressoIntents222Library UP-TO-DATE
:app:prepareComAndroidSupportTestExposedInstrumentationApiPublish05Library UP-TO-DATE
:app:prepareComAndroidSupportTestRules05Library UP-TO-DATE
:app:prepareComAndroidSupportTestRunner05Library UP-TO-DATE
:app:prepareComAndroidSupportTestUiautomatorUiautomatorV18212Library UP-TO-DATE
:app:prepareProductionDebugAndroidTestDependencies
:app:compileProductionDebugAndroidTestAidl UP-TO-DATE
:app:processProductionDebugAndroidTestManifest UP-TO-DATE
:app:compileProductionDebugAndroidTestRenderscript UP-TO-DATE
:app:generateProductionDebugAndroidTestBuildConfig UP-TO-DATE
:app:generateProductionDebugAndroidTestResValues UP-TO-DATE
:app:generateProductionDebugAndroidTestResources UP-TO-DATE
:app:mergeProductionDebugAndroidTestResources UP-TO-DATE
:app:processProductionDebugAndroidTestResources UP-TO-DATE
:app:generateProductionDebugAndroidTestSources UP-TO-DATE
:app:incrementalProductionDebugAndroidTestJavaCompilationSafeguard UP-TO-DATE
:app:compileProductionDebugAndroidTestJavaWithJavac UP-TO-DATE
:app:compileProductionDebugAndroidTestNdk UP-TO-DATE
:app:compileProductionDebugAndroidTestSources UP-TO-DATE
:app:mergeProductionDebugAndroidTestShaders UP-TO-DATE
:app:compileProductionDebugAndroidTestShaders UP-TO-DATE
:app:generateProductionDebugAndroidTestAssets UP-TO-DATE
:app:mergeProductionDebugAndroidTestAssets UP-TO-DATE
:app:transformClassesWithDexForProductionDebugAndroidTest UP-TO-DATE
:app:mergeProductionDebugAndroidTestJniLibFolders UP-TO-DATE
:app:transformNative_libsWithMergeJniLibsForProductionDebugAndroidTest UP-TO-DATE
:app:processProductionDebugAndroidTestJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForProductionDebugAndroidTest UP-TO-DATE
:app:validateSigningProductionDebugAndroidTest
:app:packageProductionDebugAndroidTest UP-TO-DATE
:app:assembleProductionDebugAndroidTest UP-TO-DATE
:app:connectedProductionDebugAndroidTest
:app:checkUiTestDebugManifest
:app:prepareUiTestDebugDependencies
:app:compileUiTestDebugAidl UP-TO-DATE
:app:compileUiTestDebugRenderscript UP-TO-DATE
:app:generateUiTestDebugBuildConfig UP-TO-DATE
:app:generateUiTestDebugResValues UP-TO-DATE
:app:generateUiTestDebugResources UP-TO-DATE
:app:mergeUiTestDebugResources UP-TO-DATE
:app:processUiTestDebugManifest UP-TO-DATE
:app:processUiTestDebugResources UP-TO-DATE
:app:generateUiTestDebugSources UP-TO-DATE
:app:incrementalUiTestDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileUiTestDebugJavaWithJavac UP-TO-DATE
:app:compileUiTestDebugNdk UP-TO-DATE
:app:compileUiTestDebugSources UP-TO-DATE
:app:mergeUiTestDebugShaders UP-TO-DATE
:app:compileUiTestDebugShaders UP-TO-DATE
:app:generateUiTestDebugAssets UP-TO-DATE
:app:mergeUiTestDebugAssets UP-TO-DATE
:app:transformClassesWithDexForUiTestDebug UP-TO-DATE
:app:mergeUiTestDebugJniLibFolders UP-TO-DATE
:app:transformNative_libsWithMergeJniLibsForUiTestDebug UP-TO-DATE
:app:processUiTestDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForUiTestDebug UP-TO-DATE
:app:validateSigningUiTestDebug
:app:packageUiTestDebug UP-TO-DATE
:app:assembleUiTestDebug UP-TO-DATE
:app:prepareUiTestDebugAndroidTestDependencies
:app:compileUiTestDebugAndroidTestAidl UP-TO-DATE
:app:processUiTestDebugAndroidTestManifest UP-TO-DATE
:app:compileUiTestDebugAndroidTestRenderscript UP-TO-DATE
:app:generateUiTestDebugAndroidTestBuildConfig UP-TO-DATE
:app:generateUiTestDebugAndroidTestResValues UP-TO-DATE
:app:generateUiTestDebugAndroidTestResources UP-TO-DATE
:app:mergeUiTestDebugAndroidTestResources UP-TO-DATE
:app:processUiTestDebugAndroidTestResources UP-TO-DATE
:app:generateUiTestDebugAndroidTestSources UP-TO-DATE
:app:incrementalUiTestDebugAndroidTestJavaCompilationSafeguard UP-TO-DATE
:app:compileUiTestDebugAndroidTestJavaWithJavac UP-TO-DATE
:app:compileUiTestDebugAndroidTestNdk UP-TO-DATE
:app:compileUiTestDebugAndroidTestSources UP-TO-DATE
:app:mergeUiTestDebugAndroidTestShaders UP-TO-DATE
:app:compileUiTestDebugAndroidTestShaders UP-TO-DATE
:app:generateUiTestDebugAndroidTestAssets UP-TO-DATE
:app:mergeUiTestDebugAndroidTestAssets UP-TO-DATE
:app:transformClassesWithDexForUiTestDebugAndroidTest UP-TO-DATE
:app:mergeUiTestDebugAndroidTestJniLibFolders UP-TO-DATE
:app:transformNative_libsWithMergeJniLibsForUiTestDebugAndroidTest UP-TO-DATE
:app:processUiTestDebugAndroidTestJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForUiTestDebugAndroidTest UP-TO-DATE
:app:validateSigningUiTestDebugAndroidTest
:app:packageUiTestDebugAndroidTest UP-TO-DATE
:app:assembleUiTestDebugAndroidTest UP-TO-DATE
:app:connectedUiTestDebugAndroidTest
:app:connectedAndroidTest UP-TO-DATE
BUILD SUCCESSFUL
Total time: 19.84 secs
Tests are executing in lines :app:connectedProductionDebugAndroidTest and :app:connectedUiTestDebugAndroidTest.
Why do gradle run the tests twice? And how to avoid it?

If you are executing connectedAndroidTest, gradle will automatically run connected(FlavorName+BuildType)AndroidTest, looks like you have 2 flavors (Production and UiTest). You probably can just run one of those commands instead of running connectedAndroidTest.

I only have one flavor app, and the command is
gradlew :app:connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.annotation=com.hello.work.annotation.Smoke, but gradlew also run testcase twice.

I know this is super dumb, but I forgot I had a phone plugged into my computer, so Gradle was trying to run tests on both my emulator AND the device. So it was running the tests twice.

Related

App debug issue

When i debug my app it will show an error like
BUILD FAILED
Total time: 1 mins 41.485 secs
Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
Parallel execution with configuration on demand is an incubating feature.
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:prepareComAndroidSupportAnimatedVectorDrawable2421Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72421Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2421Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72300Library UP-TO-DATE
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCompat2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUi2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUtils2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportFragment2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportMediaCompat2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2421Library UP-TO-DATE
:app:prepareComFacebookAndroidFacebookAndroidSdk450Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAdsLite940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuthBase940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCastFramework940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesClearcut940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesContextmanager940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGass940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIid940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlaces940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTagmanager940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTagmanagerApi940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTasks940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalytics940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuth940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuthCommon940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuthModule940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCommon940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseConfig940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCore940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCrash940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseDatabase940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseDatabaseConnection940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseIid940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseMessaging940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseStorage940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseStorageCommon940Library UP-TO-DATE
:app:prepareComGoogleMapsAndroidAndroidMapsUtils044Library UP-TO-DATE
:app:prepareComToptocheSearchablespinnerSearchablespinnerlibrary131Library UP-TO-DATE
:app:prepareOrgSolovyevAndroidViewsLinearLayoutManager05Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
Parsing json file: D:\OnGoiningProjrct\drzone\app\google-services.json
:app:generateDebugResources
:app:mergeDebugResources
Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
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: 10.975 secs
Add your google-services.json file inside /app folder and try again. This file is necessary when using the Google Play Services SDK.

gradlew bintrayUpload Android library to jcenter

After I perform gradlew bintrayUpload to upload my Android library to jcenter, it's always at "Building 97%". I am in China. This is my CLI code:
ElasticLayout ➤ ./gradlew bintrayUpload git:master*
Incremental java compilation is an incubating feature.
:ellib:preBuild UP-TO-DATE
:ellib:preReleaseBuild UP-TO-DATE
:ellib:compileReleaseNdk UP-TO-DATE
:ellib:compileLint
:ellib:copyReleaseLint UP-TO-DATE
:ellib:checkReleaseManifest
:ellib:preDebugAndroidTestBuild UP-TO-DATE
:ellib:preDebugBuild UP-TO-DATE
:ellib:preDebugUnitTestBuild UP-TO-DATE
:ellib:preReleaseUnitTestBuild UP-TO-DATE
:ellib:prepareComAndroidSupportAnimatedVectorDrawable2340Library UP-TO-DATE
:ellib:prepareComAndroidSupportAppcompatV72340Library UP-TO-DATE
:ellib:prepareComAndroidSupportRecyclerviewV72340Library UP-TO-DATE
:ellib:prepareComAndroidSupportSupportV42340Library UP-TO-DATE
:ellib:prepareComAndroidSupportSupportVectorDrawable2340Library UP-TO-DATE
:ellib:prepareReleaseDependencies
:ellib:compileReleaseAidl UP-TO-DATE
:ellib:compileReleaseRenderscript UP-TO-DATE
:ellib:generateReleaseBuildConfig UP-TO-DATE
:ellib:mergeReleaseShaders UP-TO-DATE
:ellib:compileReleaseShaders UP-TO-DATE
:ellib:generateReleaseAssets UP-TO-DATE
:ellib:mergeReleaseAssets UP-TO-DATE
:ellib:generateReleaseResValues UP-TO-DATE
:ellib:generateReleaseResources UP-TO-DATE
:ellib:mergeReleaseResources UP-TO-DATE
:ellib:processReleaseManifest UP-TO-DATE
:ellib:processReleaseResources UP-TO-DATE
:ellib:generateReleaseSources UP-TO-DATE
:ellib:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:ellib:compileReleaseJavaWithJavac UP-TO-DATE
:ellib:extractReleaseAnnotations UP-TO-DATE
:ellib:mergeReleaseProguardFiles UP-TO-DATE
:ellib:packageReleaseRenderscript UP-TO-DATE
:ellib:packageReleaseResources UP-TO-DATE
:ellib:processReleaseJavaRes UP-TO-DATE
:ellib:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:ellib:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:ellib:mergeReleaseJniLibFolders UP-TO-DATE
:ellib:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:ellib:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:ellib:bundleRelease UP-TO-DATE
:ellib:javadoc UP-TO-DATE
:ellib:javadocJar UP-TO-DATE
:ellib:sourcesJar UP-TO-DATE
:ellib:install
Building 97% > :ellib:bintrayUpload

Can't generate apk: zipalign.exe finished with non-zero exit value 1

I try to generate apk for an app.
Here is the error i got:
Information:Gradle tasks [:MyApp:assembleRelease]
Observed package id 'add-ons;addon-google_apis-google-19' in inconsistent location 'C:\Users\MyUser\AppData\Local\Android\sdk\add-ons\addon-google_apis-google-19-1' (Expected 'C:\Users\MyUser\AppData\Local\Android\sdk\add-ons\addon-google_apis-google-19')
:MyApp:preBuild UP-TO-DATE
:MyApp:preReleaseBuild UP-TO-DATE
:MyApp:checkReleaseManifest
:MyApp:preDebugBuild UP-TO-DATE
:MyAppEssentialsLib:preBuild UP-TO-DATE
:MyAppEssentialsLib:preReleaseBuild UP-TO-DATE
:MyAppEssentialsLib:compileReleaseNdk UP-TO-DATE
:MyAppEssentialsLib:compileLint
:MyAppEssentialsLib:copyReleaseLint UP-TO-DATE
:MyAppEssentialsLib:checkReleaseManifest
:MyAppEssentialsLib:preDebugAndroidTestBuild UP-TO-DATE
:MyAppEssentialsLib:preDebugBuild UP-TO-DATE
:MyAppEssentialsLib:preDebugUnitTestBuild UP-TO-DATE
:MyAppEssentialsLib:preReleaseUnitTestBuild UP-TO-DATE
:MyAppEssentialsLib:prepareComAndroidSupportAnimatedVectorDrawable2330Library UP-TO-DATE
:MyAppEssentialsLib:prepareComAndroidSupportAppcompatV72330Library UP-TO-DATE
:MyAppEssentialsLib:prepareComAndroidSupportDesign2330Library UP-TO-DATE
:MyAppEssentialsLib:prepareComAndroidSupportRecyclerviewV72330Library UP-TO-DATE
:MyAppEssentialsLib:prepareComAndroidSupportSupportV132330Library UP-TO-DATE
:MyAppEssentialsLib:prepareComAndroidSupportSupportV42330Library UP-TO-DATE
:MyAppEssentialsLib:prepareComAndroidSupportSupportVectorDrawable2330Library UP-TO-DATE
:MyAppEssentialsLib:prepareComFacebookAndroidFacebookAndroidSdk460Library UP-TO-DATE
:MyAppEssentialsLib:prepareComGithubAfollestadMaterialDialogsCore0856Library UP-TO-DATE
:MyAppEssentialsLib:prepareComGithubJkwiecienEasyImage109Library UP-TO-DATE
:MyAppEssentialsLib:prepareComGoogleAndroidGmsPlayServicesBase840Library UP-TO-DATE
:MyAppEssentialsLib:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE
:MyAppEssentialsLib:prepareComGoogleAndroidGmsPlayServicesGcm840Library UP-TO-DATE
:MyAppEssentialsLib:prepareComGoogleAndroidGmsPlayServicesLocation840Library UP-TO-DATE
:MyAppEssentialsLib:prepareComGoogleAndroidGmsPlayServicesMaps840Library UP-TO-DATE
:MyAppEssentialsLib:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library UP-TO-DATE
:MyAppEssentialsLib:prepareDeHdodenhofCircleimageview200Library UP-TO-DATE
:MyAppEssentialsLib:prepareMeZhanghaiAndroidMaterialprogressbarLibrary114Library UP-TO-DATE
:MyAppEssentialsLib:prepareReleaseDependencies
:MyAppEssentialsLib:compileReleaseAidl UP-TO-DATE
:MyAppEssentialsLib:compileReleaseRenderscript UP-TO-DATE
:MyAppEssentialsLib:generateReleaseBuildConfig UP-TO-DATE
:MyAppEssentialsLib:generateReleaseAssets UP-TO-DATE
:MyAppEssentialsLib:mergeReleaseAssets UP-TO-DATE
:MyAppEssentialsLib:generateReleaseResValues UP-TO-DATE
:MyAppEssentialsLib:generateReleaseResources UP-TO-DATE
:MyAppEssentialsLib:mergeReleaseResources UP-TO-DATE
:MyAppEssentialsLib:processReleaseManifest UP-TO-DATE
:MyAppEssentialsLib:processReleaseResources UP-TO-DATE
:MyAppEssentialsLib:generateReleaseSources UP-TO-DATE
:MyAppEssentialsLib:compileReleaseJavaWithJavac UP-TO-DATE
:MyAppEssentialsLib:extractReleaseAnnotations UP-TO-DATE
:MyAppEssentialsLib:mergeReleaseProguardFiles UP-TO-DATE
:MyAppEssentialsLib:packageReleaseRenderscript UP-TO-DATE
:MyAppEssentialsLib:packageReleaseResources UP-TO-DATE
:MyAppEssentialsLib:processReleaseJavaRes UP-TO-DATE
:MyAppEssentialsLib:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:MyAppEssentialsLib:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:MyAppEssentialsLib:mergeReleaseJniLibFolders UP-TO-DATE
:MyAppEssentialsLib:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:MyAppEssentialsLib:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:MyAppEssentialsLib:bundleRelease UP-TO-DATE
:MyApp:prepareComAndroidSupportAnimatedVectorDrawable2330Library UP-TO-DATE
:MyApp:prepareComAndroidSupportAppcompatV72330Library UP-TO-DATE
:MyApp:prepareComAndroidSupportDesign2330Library UP-TO-DATE
:MyApp:prepareComAndroidSupportRecyclerviewV72330Library UP-TO-DATE
:MyApp:prepareComAndroidSupportSupportV132330Library UP-TO-DATE
:MyApp:prepareComAndroidSupportSupportV42330Library UP-TO-DATE
:MyApp:prepareComAndroidSupportSupportVectorDrawable2330Library UP-TO-DATE
:MyApp:prepareComFacebookAndroidFacebookAndroidSdk460Library UP-TO-DATE
:MyApp:prepareComGithubAfollestadMaterialDialogsCore0856Library UP-TO-DATE
:MyApp:prepareComGithubJkwiecienEasyImage109Library UP-TO-DATE
:MyApp:prepareComGoogleAndroidGmsPlayServicesBase840Library UP-TO-DATE
:MyApp:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE
:MyApp:prepareComGoogleAndroidGmsPlayServicesGcm840Library UP-TO-DATE
:MyApp:prepareComGoogleAndroidGmsPlayServicesLocation840Library UP-TO-DATE
:MyApp:prepareComGoogleAndroidGmsPlayServicesMaps840Library UP-TO-DATE
:MyApp:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library UP-TO-DATE
:MyApp:prepareDeHdodenhofCircleimageview200Library UP-TO-DATE
:MyApp:prepareMeZhanghaiAndroidMaterialprogressbarLibrary114Library UP-TO-DATE
:MyApp:prepareReleaseDependencies
:MyApp:compileReleaseAidl UP-TO-DATE
:MyApp:compileReleaseRenderscript UP-TO-DATE
:MyApp:generateReleaseBuildConfig UP-TO-DATE
:MyApp:generateReleaseAssets UP-TO-DATE
:MyApp:mergeReleaseAssets UP-TO-DATE
:MyApp:generateReleaseResValues UP-TO-DATE
:MyApp:processReleaseGoogleServices
:MyApp:generateReleaseResources
:MyApp:mergeReleaseResources UP-TO-DATE
:MyApp:processReleaseManifest UP-TO-DATE
:MyApp:processReleaseResources UP-TO-DATE
:MyApp:generateReleaseSources UP-TO-DATE
:MyApp:compileReleaseJavaWithJavac UP-TO-DATE
:MyApp:compileReleaseNdk UP-TO-DATE
:MyApp:compileReleaseSources UP-TO-DATE
:MyApp:lintVitalRelease
:MyApp:prePackageMarkerForRelease
:MyApp:transformClassesWithDexForRelease UP-TO-DATE
:MyApp:mergeReleaseJniLibFolders UP-TO-DATE
:MyApp:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:MyApp:processReleaseJavaRes UP-TO-DATE
:MyApp:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:MyApp:validateExternalOverrideSigning
:MyApp:packageRelease UP-TO-DATE
:MyApp:zipalignRelease
Unable to open 'C:\Users\MyApp-release.apk' as zip archive
Error:Execution failed for task ':MyApp:zipalignRelease'.
> Process 'command 'C:\Users\MyUser\AppData\Local\Android\sdk\build-tools\23.0.2\zipalign.exe'' finished with non-zero exit value 1
I dont't get it whats the cause?
You should clean the project and restart Android Studio and regenerate the APK and this time change your APKpath to desktop when generating .
it will most probably solve your issue.
The destination path C:\Users\MyApp-release.apk seems wrong.
It should be something like C:\Users\MyUser\MyApp-release.apk.

How to run application with library in debug build variant?

I have trouble with launching application in debug build type. I have application which depends on library, which depens on another library. I switched everything to debug build variant, same as in image.
Problrem is that inside library I have few functionality which I want to turn off in debug, such as loggin and analytics, but library every time compiles in release build type.
In Gradle console I see that application compiling in debug variant, but every project that it depends on compiling in release variant.
Executing tasks: [:app:assembleDebug]
Parallel execution with configuration on demand is an incubating feature.
/home/cooperok/AndroidStudioWorkspace/MyApp/app/build/outputs/apk/app-debug.apk
app-debug-1.0.5.apk
/home/cooperok/AndroidStudioWorkspace/MyApp/app/build/outputs/apk/app-release.apk
app-release-1.0.5.apk
:app:preBuild
:library:compileLint UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:library:copyReleaseLint UP-TO-DATE
:library:preBuild
:library-2:compileLint UP-TO-DATE
:library-2:copyReleaseLint UP-TO-DATE
:library:preReleaseBuild
:library-2:mergeReleaseProguardFiles UP-TO-DATE
:library:checkReleaseManifest
:library:preReleaseUnitTestBuild UP-TO-DATE
:library:generateReleaseBuildConfig UP-TO-DATE
:library-2:preBuild UP-TO-DATE
:library-2:preReleaseBuild UP-TO-DATE
:library-2:checkReleaseManifest
:library-2:prepareReleaseDependencies UP-TO-DATE
:library:generateReleaseAssets UP-TO-DATE
:library:generateReleaseResValues UP-TO-DATE
:library:processReleaseJavaRes UP-TO-DATE
:library:mergeReleaseProguardFiles UP-TO-DATE
:library:compileReleaseNdk UP-TO-DATE
:library:packageReleaseJniLibs UP-TO-DATE
:library:packageReleaseLocalJar UP-TO-DATE
:library:packageReleaseRenderscript
:library-2:compileReleaseAidl UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:library:preReleaseBuild UP-TO-DATE
:library-2:compileReleaseRenderscript
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:validateDebugSigning
:library-2:compileReleaseRenderscript UP-TO-DATE
:library-2:generateReleaseBuildConfig UP-TO-DATE
:library-2:generateReleaseAssets UP-TO-DATE
:library-2:mergeReleaseAssets UP-TO-DATE
:library-2:generateReleaseResValues UP-TO-DATE
:library-2:generateReleaseResources UP-TO-DATE
:library-2:packageReleaseResources UP-TO-DATE
:library-2:processReleaseManifest UP-TO-DATE
:library-2:processReleaseResources UP-TO-DATE
:library-2:generateReleaseSources UP-TO-DATE
:library-2:processReleaseJavaRes UP-TO-DATE
:library-2:compileReleaseJava UP-TO-DATE
:library-2:packageReleaseJar UP-TO-DATE
:library-2:compileReleaseNdk UP-TO-DATE
:library-2:packageReleaseJniLibs UP-TO-DATE
:library-2:packageReleaseLocalJar UP-TO-DATE
:library-2:packageReleaseRenderscript UP-TO-DATE
:library-2:bundleRelease UP-TO-DATE
:library:prepareComAndroidSupportSupportV42211Library UP-TO-DATE
:library:prepareComCrashlyticsSdkAndroidAnswers122Library UP-TO-DATE
:library:prepareComCrashlyticsSdkAndroidBeta112Library UP-TO-DATE
:library:prepareComCrashlyticsSdkAndroidCrashlytics232Library UP-TO-DATE
:library:prepareComCrashlyticsSdkAndroidCrashlyticsCore232Library UP-TO-DATE
:library:prepareComGoogleAndroidGmsPlayServicesBase730Library UP-TO-DATE
:library:prepareComGoogleAndroidGmsPlayServicesMaps730Library UP-TO-DATE
:library:prepareIoFabricSdkAndroidFabric133Library UP-TO-DATE
:library:prepareReleaseDependencies
:library:compileReleaseAidl
:library:compileReleaseRenderscript UP-TO-DATE
:library:mergeReleaseAssets UP-TO-DATE
:library:generateReleaseResources UP-TO-DATE
:library:mergeReleaseResources UP-TO-DATE
:library:processReleaseManifest UP-TO-DATE
:library:processReleaseResources UP-TO-DATE
:library:generateReleaseSources
:library:compileReleaseJava
So after compiling project variable BuildConfig.DEBUG inside library is false
How to compile everything in debug build variant?
It turns out that this is known issue, and there is bug report since 2013 at code.google.com.
I founded there solution. To run every project in build variant that you need, you should setting this in the dependency project
android {
publishNonDefault true
...
}
and this in the project that uses it
dependencies {
releaseCompile project(path: ':theotherproject', configuration: 'release')
debugCompile project(path: ':theotherproject', configuration: 'debug')
}

Android Facebook integration: Failed to complete gradle execution. No Cause

I am trying to integrated Facebook sign in to my application. If I added below lines to my build.gradle file for the application:
repositories {
mavenCentral()
}
in dependencies
compile 'com.facebook.android:facebook-android-sdk:4.2.0'
After that if I rebuild project it rebuilds it successfully. But when I try to run it takes long time to build and then shows dialog with text:
Failed to complete Gradle execution.
Casue:
Though the Message Gradle Build windows does not show any error. Here is the output of it
Information:Gradle tasks [:app:assembleDebug]
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72220Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2220Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72200Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42220Library UP-TO-DATE
:app:prepareComFacebookAndroidFacebookAndroidSdk420Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable750Library UP-TO-DATE
:app:prepareTextvalidatorLibrary UP-TO-DATE
:app:prepareThreepioLibrary 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:processDebugGoogleServices
File google-services.json is missing from module root folder. The Google Quickstart Plugin cannot function without it.
:app:generateDebugResources
: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:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug
:app:dexDebug
Information:0 errors
Information:0 warnings
Information:See complete output in console
I also modified the Gradle VM options as -XX:MaxHeapSize=256m -Xmx256m but still it gives the error.
If I remove the dependency it works fine. I am not sure why this happens.
Executing this command ./gradlew assembleDebug in my project directory showed the real culprit of the problem.
When I add facebook SDK dependency to my project it exceeds the limit of 64K methods in my dex file. Due to this the gradle build was failing.
I added multiDexEnabled = true into my build types in build.gradle file. And derive my custom application class from MultiDexApplication instead of Application.
This solved my issue.

Categories

Resources