Google Cloud Messaging - Google services sample Gradle unknown error - android

I have downloaded the Google services sample from here and when I try to run it following the steps about the JSON, then an error pops out. The problem is that the console and the log, shows nothing about this error.
It looks like this.
I have no idea what am I doing wrong but, after this, I can't try to run it again, because the Run button is disabled.
Any idea to solve this?
UPDATE: This is the log in the Gradle Console:
Configuration on demand is an incubating feature.
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72211Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72200Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42211Library 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: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
No matching client found for package name 'gcm.play.android.samples.com.gcmquickstart'
: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
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:preDexDebug
:app:dexDebug
AGPBI: {"kind":"simple","text":"Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar ","sources":[{}]}
:app:validateDebugSigning
:app:packageDebug
:app:zipalignDebug
:app:assembleDebug
BUILD SUCCESSFUL
Total time: 19.379 secs

This works for me:
In build.gradle(app) I have
applicationId "com.examples.Activities"
and in google-services.json I have
"package_name": "com.examples"
I changed
"package_name": "com.examples"
to
"package_name": "com.examples.Activities"

I was encountered the same problem.
How I solve it is to modify the file "build.gradle(Project: gcm)".
in file of build.gradle(Project: gcm)
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
classpath 'com.google.gms:google-services:1.3.0-beta1'// downgrade it version
}
}
Hope this would help you.

This must be because you are using different application id for different flavours.
I solved it by getting a google-services.json for my application ids.
For more details: google-services.json for different productFlavors
Official: https://developers.google.com/android/guides/google-services-plugin#adding_the_json_file

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.

Why does Gradle run tests twice?

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.

Android Studios RuntimeException: Unexpected exception in dex writer thread

I have been getting this strange error the whole of today - anyone know what is going wrong here?
As far as I know, I have been using the multidex library correctly (the below is from the app.gradle file):
defaultConfig {
applicationId "com.example.simon"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
/*Enabling multidex*/
multiDexEnabled true
}
dependencies {
/* Enabling multidex*/
compile 'com.android.support:multidex:1.0.1'
}
My top level gradle file is very basic:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.google.gms:google-services:1.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Error:
Executing tasks: [:app:generateDebugSources,
:app:generateDebugAndroidTestSources]
Parallel execution with 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:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2301Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportPaletteV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComDigitsSdkAndroidDigits162Library UP-TO-DATE
:app:prepareComFacebookAndroidFacebookAndroidSdk440Library UP-TO-DATE
:app:prepareComFacebookConcealConceal101Library UP-TO-DATE
:app:prepareComGithubCurioustechizenAndroidAgoLibrary130Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite780Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase780Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm780Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation780Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps780Library UP-TO-DATE
:app:prepareComTheartofdevEdmodoAndroidImageCropper104Library UP-TO-DATE
:app:prepareComTwitterSdkAndroidTweetComposer080Library UP-TO-DATE
:app:prepareComTwitterSdkAndroidTweetUi131Library UP-TO-DATE
:app:prepareComTwitterSdkAndroidTwitter161Library UP-TO-DATE
:app:prepareComTwitterSdkAndroidTwitterCore141Library UP-TO-DATE
:app:prepareIoFabricSdkAndroidFabric134Library 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
:app:generateDebugResources
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:fabricGenerateResourcesDebug
:app:processDebugResources
:app:generateDebugSources
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl UP-TO-DATE
:app:processDebugAndroidTestManifest UP-TO-DATE
:app:compileDebugAndroidTestRenderscript UP-TO-DATE
:app:generateDebugAndroidTestBuildConfig UP-TO-DATE
:app:generateDebugAndroidTestAssets UP-TO-DATE
:app:mergeDebugAndroidTestAssets UP-TO-DATE
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources UP-TO-DATE
:app:mergeDebugAndroidTestResources UP-TO-DATE
:app:processDebugAndroidTestResources UP-TO-DATE
:app:generateDebugAndroidTestSources UP-TO-DATE
BUILD SUCCESSFUL
Total time: 3.913 secs Executing tasks: [:app:assembleDebug]
Parallel execution with 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:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2301Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportPaletteV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComDigitsSdkAndroidDigits162Library UP-TO-DATE
:app:prepareComFacebookAndroidFacebookAndroidSdk440Library UP-TO-DATE
:app:prepareComGithubCurioustechizenAndroidAgoLibrary130Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite780Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase780Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm780Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation780Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps780Library UP-TO-DATE
:app:prepareComTheartofdevEdmodoAndroidImageCropper104Library
: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
:app:generateDebugResources
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:fabricGenerateResourcesDebug
:app:processDebugResources
:app:generateDebugSources
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:collectDebugMultiDexComponents UP-TO-DATE
:app:packageAllDebugClassesForMultiDex UP-TO-DATE
:app:shrinkDebugMultiDexComponents UP-TO-DATE
:app:createDebugMainDexClassList UP-TO-DATE
:app:dexDebugExecuting
tasks: [:app:assembleDebug]
Parallel execution with 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:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2301Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportPaletteV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComDigitsSdkAndroidDigits162Library 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
:app:generateDebugResources
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:fabricGenerateResourcesDebug
:app:processDebugResources
:app:generateDebugSources
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:collectDebugMultiDexComponents UP-TO-DATE
:app:packageAllDebugClassesForMultiDex UP-TO-DATE
:app:shrinkDebugMultiDexComponents UP-TO-DATE
:app:createDebugMainDexClassList UP-TO-DATE
:app:dexDebug AGPBI:
{"kind":"simple","text":"UNEXPECTED TOP-LEVEL
EXCEPTION:","sources":[{}]} AGPBI:
{"kind":"simple","text":"java.lang.RuntimeException: Unexpected
exception in dex writer thread","sources":[{}]} AGPBI:
{"kind":"simple","text":"\tat
com.android.dx.command.dexer.Main.runMultiDex(Main.java:397)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat
com.android.dx.command.dexer.Main.run(Main.java:275)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat
com.android.dx.command.dexer.Main.main(Main.java:245)","sources":[{}]}
AGPBI: {"kind":"simple","text":"\tat
com.android.dx.command.Main.main(Main.java:106)","sources":[{}]}
FAILED
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command
'C:\Program Files\Java\jdk1.7.0_76\bin\java.exe'' finished with
non-zero exit value 2
* 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 5.426 secs
After googling for a while, I found the problem was that not enough heap was allocated to the dex writer.
I fixed it by putting in the following in my app gradle.build:
android {
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}
This option also managed to speed up my gradle build significantly.
Extremely long build with Gradle (Android Studio)
Adding this to my Project level gradle.properties helped -
org.gradle.jvmargs=-Xmx1536m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
change your manifist to this
defaultConfig
{
applicationId "com.example.simon"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
/*Enabling multidex*/
multiDexEnabled true
}
android {
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}
dependencies {
/* Enabling multidex*/
compile 'com.android.support:multidex:1.0.1'
}
and this problem shows when you add the :
/*Enabling multidex*/
multiDexEnabled true
most of the times.
and for more information please tell me the exact thing you didnt undestand

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