dexDebugTest fails with DexException "Cannot merge new index" for test - android

I'm building an android project with gradle that leverages Google Espresso (much thanks to Jake Wharton's double espresso). With my build.gradle configuration I can successfully build debug and release versions using proguard to optimize my method counts (to get below the 65k limit), but when I run connectedAndroidTest my build fails with:
...
:src:MyApp:proguardDebug UP-TO-DATE
:src:MyApp:proguardDebugTest UP-TO-DATE
:src:MyApp:dexDebugTest UP-TO-DATE
:src:MyAppLibrary:prepareDebugTestDependencies
:src:MyAppLibrary:compileDebugTestAidl UP-TO-DATE
:src:MyAppLibrary:copyDebugLint UP-TO-DATE
:src:MyAppLibrary:mergeDebugProguardFiles UP-TO-DATE
:src:MyAppLibrary:checkDebugManifest
:src:MyAppLibrary:prepareDebugDependencies
:src:MyAppLibrary:compileDebugAidl UP-TO-DATE
:src:MyAppLibrary:compileDebugRenderscript UP-TO-DATE
:src:MyAppLibrary:generateDebugBuildConfig UP-TO-DATE
:src:MyAppLibrary:generateDebugAssets UP-TO-DATE
:src:MyAppLibrary:mergeDebugAssets UP-TO-DATE
:src:MyAppLibrary:generateDebugResValues UP-TO-DATE
:src:MyAppLibrary:generateDebugResources UP-TO-DATE
:src:MyAppLibrary:mergeDebugResources UP-TO-DATE
:src:MyAppLibrary:processDebugManifest UP-TO-DATE
:src:MyAppLibrary:processDebugResources UP-TO-DATE
:src:MyAppLibrary:generateDebugSources UP-TO-DATE
:src:MyAppLibrary:compileDebugJava UP-TO-DATE
:src:MyAppLibrary:processDebugJavaRes UP-TO-DATE
:src:MyAppLibrary:packageDebugJar UP-TO-DATE
:src:MyAppLibrary:compileDebugNdk UP-TO-DATE
:src:MyAppLibrary:packageDebugJniLibs UP-TO-DATE
:src:MyAppLibrary:packageDebugLocalJar UP-TO-DATE
:src:MyAppLibrary:packageDebugRenderscript UP-TO-DATE
:src:MyAppLibrary:packageDebugResources UP-TO-DATE
:src:MyAppLibrary:bundleDebug
:src:MyAppLibrary:assembleDebug
:src:MyAppLibrary:processDebugTestManifest UP-TO-DATE
:src:MyAppLibrary:compileDebugTestRenderscript UP-TO-DATE
:src:MyAppLibrary:generateDebugTestBuildConfig UP-TO-DATE
:src:MyAppLibrary:generateDebugTestAssets UP-TO-DATE
:src:MyAppLibrary:mergeDebugTestAssets UP-TO-DATE
:src:MyAppLibrary:generateDebugTestResValues UP-TO-DATE
:src:MyAppLibrary:generateDebugTestResources UP-TO-DATE
:src:MyAppLibrary:mergeDebugTestResources UP-TO-DATE
:src:MyAppLibrary:processDebugTestResources UP-TO-DATE
:src:MyAppLibrary:generateDebugTestSources UP-TO-DATE
:src:MyAppLibrary:compileDebugTestJava UP-TO-DATE
:src:MyAppLibrary:preDexDebugTest UP-TO-DATE
:src:MyAppLibrary:dexDebugTest
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Cannot merge new index 65623 into a non-jumbo instruction!
at com.android.dx.merge.InstructionTransformer.jumboCheck(InstructionTransformer.java:108)
at com.android.dx.merge.InstructionTransformer.access$800(InstructionTransformer.java:25)
at com.android.dx.merge.InstructionTransformer$StringVisitor.visit(InstructionTransformer.java:71)
at com.android.dx.io.CodeReader.callVisit(CodeReader.java:114)
at com.android.dx.io.CodeReader.visitAll(CodeReader.java:89)
at com.android.dx.merge.InstructionTransformer.transform(InstructionTransformer.java:48)
at com.android.dx.merge.DexMerger.transformCode(DexMerger.java:840)
at com.android.dx.merge.DexMerger.transformMethods(DexMerger.java:811)
at com.android.dx.merge.DexMerger.transformClassData(DexMerger.java:784)
at com.android.dx.merge.DexMerger.transformClassDef(DexMerger.java:680)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:540)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
:src:MyAppLibrary:dexDebugTest FAILED
My app is called MyApp and it has a dependency project called MyAppLibrary. Before switching to espresso I didn't hit the 65k limit when running connectedAndroidTest. I used robotium before and I've since removed those dependencies. Also, I don't hit the limit when I just build a debug or release build. Is there a way to optimize my test build like I am optimizing my debug build?
The odd thing to me is that I only have tests in MyApp, I don't have any test classes in MyAppLibrary. In fact, when I run connectedAndroidTest, I can actually see my tests running on my device and passing before it gets to MyAppLibrary:dexDebugTest. So any idea why it would fail there after running my tests?
Alternatively, would it be possible to somehow bypass calling the connectedAndroidTest dependency chain for MyAppLibrary?
Thanks!

In the build.gradle You need to specify:
android {
dexOptions {
jumboMode true
}
}

Related

Jenkins-pipeline fail : No such DSL method 'androidLint' found among steps

I get a failure for the stage 'Static analysis' during my jenkins-pipeline.
Here is my Jenkinsfile :
pipeline {
agent any
stages {
stage('Compile') {
steps {
// Compile the app and its dependencies
sh './gradlew compileDebugSources'
}
}
stage('Unit test') {
steps {
// Compile and run the unit tests for the app and its dependencies
sh './gradlew testDebugUnitTest testDebugUnitTest'
// Analyse the test results and update the build result as appropriate
junit '**/TEST-*.xml'
}
}
stage('Build APK') {
steps {
// Finish building and packaging the APK
sh './gradlew assembleDebug'
// Archive the APKs so that they can be downloaded from Jenkins
archiveArtifacts '**/*.apk'
}
}
stage('Static analysis') {
steps {
// Run Lint and analyse the results
sh './gradlew lintDebug'
androidLint pattern: '**/lint-results-*.xml'
}
}
stage('Deploy') {
steps {
// Build the app in release mode, and sign the APK using the environment variables
sh './gradlew assembleRelease'
// Archive the APKs so that they can be downloaded from Jenkins
archiveArtifacts '**/*.apk'
}
}
}
}
Here is the Console Output :
[Pipeline] stage
[Pipeline] { (Static analysis)
[Pipeline] sh
+ ./gradlew lintDebug
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:checkDebugAarMetadata UP-TO-DATE
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:extractDeepLinksDebug UP-TO-DATE
> Task :app:javaPreCompileDebug UP-TO-DATE
> Task :app:mergeDebugResources UP-TO-DATE
> Task :app:processDebugMainManifest UP-TO-DATE
> Task :app:processDebugManifest UP-TO-DATE
> Task :app:processDebugManifestForPackage UP-TO-DATE
> Task :app:processDebugResources UP-TO-DATE
> Task :app:compileDebugKotlin UP-TO-DATE
> Task :app:compileDebugJavaWithJavac UP-TO-DATE
> Task :app:lintDebug
Wrote HTML report to file:///var/jenkins_home/workspace/Pushr_master/app/build/reports/lint-results-debug.html
Wrote XML report to file:///var/jenkins_home/workspace/Pushr_master/app/build/reports/lint-results-debug.xml
BUILD SUCCESSFUL in 23s
14 actionable tasks: 1 executed, 13 up-to-date
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Deploy)
Stage "Deploy" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
GitHub has been notified of this commit’s build result
java.lang.NoSuchMethodError: No such DSL method 'androidLint' found among steps [archive, bat, build, catchError, checkout, compareVersions, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, echo, emailext, emailextrecipients, envVarsForTool, error, fileExists, findBuildScans, findFiles, getContext, git, input, isUnix, jiraComment, jiraIssueSelector, jiraSearch, junit, library, libraryResource, load, lock, mail, milestone, node, nodesByLabel, parallel, powershell, properties, publishChecks, publishHTML, publishIssues, pwd, pwsh, readCSV, readFile, readJSON, readManifest, readMavenPom, readProperties, readTrusted, readYaml, recordIssues, resolveScm, retry, scanForIssues, script, sh, sha1, sleep, stage, stash, step, tee, timeout, timestamps, tm, tool, touch, unarchive, unstable, unstash, unzip, validateDeclarativePipeline, waitUntil, warnError, withContext, withCredentials, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, withGradle, wrap, writeCSV, writeFile, writeJSON, writeMavenPom, writeYaml, ws, zip] or symbols [PVSStudio, acuCobol, ajc, all, allBranchesSame, allOf, always, androidLintParser, ansibleLint, ant, antFromApache, antOutcome, antTarget, any, anyOf, apiToken, architecture, archiveArtifacts, armCc, artifactManager, authorizationMatrix, axivion, axivionSuite, batchFile, bitbucket, bitbucketBranchDiscovery, bitbucketForkDiscovery, bitbucketPublicRepoPullRequestFilter, bitbucketPullRequestDiscovery, bitbucketSshCheckout, bitbucketTagDiscovery, bitbucketTrustEveryone, bitbucketTrustNobody, bitbucketTrustProject, bitbucketTrustTeam, bitbucketWebhookConfiguration, bitbucketWebhookRegistration, booleanParam, branch, brokenBuildSuspects, brokenTestsSuspects, buckminster, buildButton, buildDiscarder, buildDiscarders, buildRetention, buildUser, buildingTag, cadence, cargo, caseInsensitive, caseSensitive, ccm, certificate, changeRequest, changelog, changeset, checkStyle, checkoutToSubdirectory, choice, choiceParam, clair, clang, clangAnalyzer, clangTidy, cleanWs, clock, cmake, codeAnalysis, codeNarc, command, coolflux, cpd, cppCheck, cppLint, credentials, cron, crumb, cssLint, culprits, defaultFolderConfiguration, defaultView, demand, detekt, developers, diabC, disableConcurrentBuilds, disableResume, docFx, docker, dockerCert, dockerLint, dockerServer, dockerTool, dockerfile, downstream, doxygen, drMemory, dscanner, dumb, dupFinder, durabilityHint, eclipse, email-ext, envVars, envVarsFilter, environment, equals, erlc, errorProne, esLint, excludeCategory, excludeFile, excludeMessage, excludeModule, excludeNamespace, excludePackage, excludeType, expression, file, fileParam, filePath, findBugs, fingerprint, fingerprints, flake8, flawfinder, flexSdk, frameOptions, freeStyle, freeStyleJob, fromDocker, fromScm, fromSource, fxcop, gcc, gcc3, gcc4, gendarme, ghsMulti, git, gitBranchDiscovery, gitHubBranchDiscovery, gitHubBranchHeadAuthority, gitHubExcludeArchivedRepositories, gitHubExcludePublicRepositories, gitHubForkDiscovery, gitHubPullRequestDiscovery, gitHubSshCheckout, gitHubTagDiscovery, gitHubTopicsFilter, gitHubTrustContributors, gitHubTrustEveryone, gitHubTrustNobody, gitHubTrustPermissions, gitTagDiscovery, github, githubPush, gnat, gnuFortran, goLint, goVet, gradle, groovyScript, hadoLint, headRegexFilter, headWildcardFilter, hyperlink, hyperlinkToModels, iar, iarCstat, ibLinter, ideaInspection, includeCategory, includeFile, includeMessage, includeModule, includeNamespace, includePackage, includeType, infer, inheriting, inheritingGlobal, installSource, intel, invalids, isRestartedRun, issues, java, javaDoc, javadoc, jcReport, jdk, jdkInstaller, jgit, jgitapache, jnlp, jobBuildDiscarder, jobName, jsHint, jsLint, junitParser, junitTestResultStorage, klocWork, kotlin, ktLint, label, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, legacy, legacySCM, list, local, location, logRotator, loggedInUsersCanDoAnything, mailer, masterBuild, maven, maven3Mojos, mavenConsole, mavenErrors, mavenMojos, mavenWarnings, metrowerksCodeWarrior, mineRepository, modelsim, modernSCM, msBuild, myPy, myView, nagFortran, namedBranchesDifferent, newContainerPerStage, node, nodeProperties, nonInheriting, none, not, overrideIndexTriggers, paneStatus, parallelsAlwaysFailFast, parameters, password, pattern, pcLint, pep8, perforce, perlCritic, permanent, php, phpCodeSniffer, phpStan, pipeline-model, pipeline-model-docker, pipelineTriggers, pit, plainText, plugin, pmdParser, pollSCM, prefast, preserveStashes, projectNamingStrategy, protoLint, proxy, pruneTags, puppetLint, pyDocStyle, pyLint, qacSourceCodeAnalyser, queueItemAuthenticator, quietPeriod, rateLimit, rateLimitBuilds, recipients, recordIssues, requestor, resharperInspectCode, resourceRoot, retainOnlyVariables, rfLint, robocopy, ruboCop, run, runParam, sSHLauncher, scala, schedule, scmRetryCount, scriptApproval, scriptApprovalLink, search, security, shell, simian, simpleBuildDiscarder, skipDefaultCheckout, skipStagesAfterUnstable, slave, sonarQube, sourceRegexFilter, sourceWildcardFilter, sphinxBuild, spotBugs, ssh, sshPublicKey, sshUserPrivateKey, standard, status, string, stringParam, styleCop, sunC, suppressAutomaticTriggering, swapSpace, swiftLint, tag, tagList, taskScanner, taskingVx, teamSlugFilter, text, textParam, tiCss, timestamper, timestamperConfig, timezone, tmpSpace, tnsdl, toolLocation, triggeredBy, tsLint, unsecured, untrusted, upstream, upstreamDevelopers, userSeed, usernameColonPassword, usernamePassword, viewsTabBar, warningsParsers, warningsPlugin, weather, withAnt, x509ClientCert, xlc, xmlLint, yamlLint, yuiCompressor, zfs, zip, zptLint] or globals [currentBuild, docker, env, params, pipeline, scm]
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:216)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
at sun.reflect.GeneratedMethodAccessor475.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
at WorkflowScript.run(WorkflowScript:32)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.delegateAndExecute(ModelInterpreter.groovy:137)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.executeSingleStage(ModelInterpreter.groovy:661)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.catchRequiredContextForNode(ModelInterpreter.groovy:395)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.catchRequiredContextForNode(ModelInterpreter.groovy:393)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.executeSingleStage(ModelInterpreter.groovy:660)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:288)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.toolsBlock(ModelInterpreter.groovy:544)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.toolsBlock(ModelInterpreter.groovy:543)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:276)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.withEnvBlock(ModelInterpreter.groovy:443)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.withEnvBlock(ModelInterpreter.groovy:442)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:275)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.withCredentialsBlock(ModelInterpreter.groovy:481)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.withCredentialsBlock(ModelInterpreter.groovy:480)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:274)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inDeclarativeAgent(ModelInterpreter.groovy:586)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inDeclarativeAgent(ModelInterpreter.groovy:585)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:272)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.stageInput(ModelInterpreter.groovy:356)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.stageInput(ModelInterpreter.groovy:355)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:261)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inWrappers(ModelInterpreter.groovy:613)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inWrappers(ModelInterpreter.groovy:612)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:259)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.withEnvBlock(ModelInterpreter.groovy:443)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.withEnvBlock(ModelInterpreter.groovy:442)
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:254)
at ___cps.transform___(Native Method)
at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:86)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
at sun.reflect.GeneratedMethodAccessor178.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
at sun.reflect.GeneratedMethodAccessor190.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
at com.cloudbees.groovy.cps.Next.step(Next.java:83)
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:400)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:312)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:276)
at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:136)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
I am not sure why I get "No such DSL method 'androidLint' found among steps".
I thought it's a jenkins-plugin problem, since Android Lint Plugin seems deprecated, I can't access to the link : https://plugins.jenkins.io/android-lint/
I installed the plugin : Warnings Next Generation => https://plugins.jenkins.io/warnings-ng/
that seems to contain Android Lint Plugin, and yet, I still get the error : No such DSL method 'androidLint'...
Does someone have any idea why the stage('Static analysis') fail ? Is it a missing plugin ?
Thank you.
After investigation, it seems "androidLint" is not supported by "Warnings Next Generation Plugin", and has been replaced by "androidLintParser"
the correct step with Warning Next Generation plugin is :
stage('Static analysis') {
steps {
// Run Lint and analyse the results
sh './gradlew lintDebug'
androidLintParser pattern: '**/lint-results-*.xml'
}
}

error while running `detox build -c android.emu.debug` Task :app:compileDebugJavaWithJavac FAILED in react native

While following the Detox [installation tutorial for android][1], I had the following error running the detox build -c android.emu.debug
❯ detox build -c android.emu.debug detox[23052] INFO: [build.js] cd android && ./gradlew assembleDebug assembleAndroidTest
-DtestBuildType=debug && cd ..
Task :app:generatePackageList
Task :app:preBuild
Task :react-native-gesture-handler:preBuild UP-TO-DATE
Task :react-native-gesture-handler:preDebugBuild UP-TO-DATE
Task :react-native-gesture-handler:checkDebugManifest UP-TO-DATE
Task :react-native-gesture-handler:processDebugManifest UP-TO-DATE
Task :react-native-reanimated:preBuild UP-TO-DATE
Task :react-native-reanimated:preDebugBuild UP-TO-DATE
Task :react-native-reanimated:checkDebugManifest UP-TO-DATE
Task :react-native-reanimated:processDebugManifest UP-TO-DATE
Task :react-native-screens:preBuild UP-TO-DATE
Task :react-native-screens:preDebugBuild UP-TO-DATE
Task :react-native-screens:checkDebugManifest UP-TO-DATE
Task :react-native-screens:processDebugManifest UP-TO-DATE
Task :react-native-vector-icons:preBuild UP-TO-DATE
Task :react-native-vector-icons:preDebugBuild UP-TO-DATE
Task :react-native-vector-icons:checkDebugManifest UP-TO-DATE
Task :react-native-vector-icons:processDebugManifest UP-TO-DATE
Task :react-native-webview:preBuild UP-TO-DATE
Task :react-native-webview:preDebugBuild UP-TO-DATE
Task :react-native-webview:checkDebugManifest UP-TO-DATE
Task :react-native-webview:processDebugManifest UP-TO-DATE
Task :app:preDebugBuild UP-TO-DATE
Task :react-native-screens:compileDebugAidl NO-SOURCE
Task :react-native-vector-icons:compileDebugAidl NO-SOURCE
Task :react-native-gesture-handler:compileDebugAidl NO-SOURCE
Task :react-native-reanimated:compileDebugAidl NO-SOURCE
Task :react-native-webview:compileDebugAidl NO-SOURCE
Task :app:compileDebugAidl NO-SOURCE
Task :react-native-gesture-handler:packageDebugRenderscript NO-SOURCE
Task :react-native-reanimated:packageDebugRenderscript NO-SOURCE
Task :react-native-screens:packageDebugRenderscript NO-SOURCE
Task :react-native-vector-icons:packageDebugRenderscript NO-SOURCE
Task :react-native-webview:packageDebugRenderscript NO-SOURCE
Task :app:compileDebugRenderscript NO-SOURCE
Task :app:checkDebugManifest UP-TO-DATE
Task :app:generateDebugBuildConfig UP-TO-DATE
Task :app:bundleDebugJsAndAssets SKIPPED
Task :app:prepareLintJar UP-TO-DATE
Task :app:generateDebugSources UP-TO-DATE
Task :react-native-gesture-handler:generateDebugBuildConfig UP-TO-DATE
Task :react-native-gesture-handler:compileDebugRenderscript NO-SOURCE
Task :react-native-gesture-handler:generateDebugResValues UP-TO-DATE
Task :react-native-gesture-handler:generateDebugResources UP-TO-DATE
Task :react-native-gesture-handler:prepareLintJar UP-TO-DATE
Task :react-native-gesture-handler:generateDebugSources UP-TO-DATE
Task :react-native-gesture-handler:javaPreCompileDebug UP-TO-DATE
Task :react-native-gesture-handler:packageDebugResources UP-TO-DATE
Task :react-native-gesture-handler:generateDebugRFile UP-TO-DATE
> Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED
/home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.java:4:
error: package com.facebook.react.module.annotations does not exist
import com.facebook.react.module.annotations.ReactModule;
^ /home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootViewManager.java:17:
error: cannot find symbol #ReactModule(name =
RNGestureHandlerRootViewManager.REACT_CLASS) ^ symbol: class
ReactModule
/home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:16:
error: package com.facebook.react.module.annotations does not exist
import com.facebook.react.module.annotations.ReactModule;
^ /home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:19:
error: cannot find symbol import com.facebook.react.uimanager.UIBlock;
^ symbol: class UIBlock location: package com.facebook.react.uimanager
/home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:40:
error: cannot find symbol
#ReactModule(name=RNGestureHandlerModule.MODULE_NAME) ^ symbol:
class ReactModule
/home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java:218:
error: cannot find symbol #ReactProp(name = ViewProps.BORDER_RADIUS)
^ symbol: variable BORDER_RADIUS location: class ViewProps
/home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.java:41:
error: method init in class Event cannot be applied to given types;
super.init(handler.getView().getId());
^ required: int,long found: int reason: actual and formal argument lists differ in length where T is a type-variable:
T extends Event declared in class Event /home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.java:45:
error: cannot find symbol
return parent.getChildAt(((ReactViewGroup) parent).getZIndexMappedChildIndex(index));
^ symbol: method getZIndexMappedChildIndex(int) location: class ReactViewGroup
/home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNViewConfigurationHelper.java:54:
error: cannot find symbol
String overflow = ((ReactViewGroup) view).getOverflow();
^ symbol: method getOverflow() location: class ReactViewGroup
/home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:574:
error: cannot find symbol
final int rootViewTag = uiManager.resolveRootTagFromReactTag(ancestorViewTag);
^ symbol: method resolveRootTagFromReactTag(int) location: variable uiManager of type
UIManagerModule
/home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:582:
error: cannot find symbol
if (root.getRootView().getRootViewTag() == rootViewTag) {
^ symbol: method getRootViewTag() location: class ReactRootView
/home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:598:
error: cannot find symbol
uiManager.addUIBlock(new UIBlock() {
^ symbol: class UIBlock location: class RNGestureHandlerModule
/home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:634:
error: cannot find symbol
int rootViewTag = uiManager.resolveRootTagFromReactTag(viewTag);
^ symbol: method resolveRootTagFromReactTag(int) location: variable uiManager of type
UIManagerModule
/home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:641:
error: cannot find symbol
if (root.getRootView().getRootViewTag() == rootViewTag) {
^ symbol: method getRootViewTag() location: class ReactRootView
/home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerPackage.java:18:
error: RNGestureHandlerPackage is not abstract and does not override
abstract method createJSModules() in ReactPackage public class
RNGestureHandlerPackage implements ReactPackage {
^ /home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java:45:
error: method init in class Event cannot be applied to given types;
super.init(handler.getView().getId());
^ required: int,long found: int reason: actual and formal argument lists differ in length where T is a type-variable:
T extends Event declared in class Event Note: /home/rogerd/dev/app_cachacagestor/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java
uses or overrides a deprecated API. Note: Recompile with
-Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for
details. 16 errors
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':react-native-gesture-handler:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it
incompatible with Gradle 6.0. Use '--warning-mode all' to show the
individual deprecation warnings. See
https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 5s 22 actionable tasks: 2 executed, 20 up-to-date
detox[23052] ERROR: [cli.js] Error: Command failed: cd android &&
./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug &&
cd ..
"react": "16.8.6",
"react-native": "0.60.5",
"detox": "^14.3.2",
"mocha": "^6.2.0",
Does anyone know how to solve ?
I solved it by changing the order of the maven repositories in android/build.gradle. My allprojects looks like this:
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
maven {
// All of Detox' artifacts are provided via the npm module
url "$rootDir/../node_modules/detox/Detox-android"
}
maven { url 'https://www.jitpack.io' }
}
}
Thanks to gypsicoder
https://github.com/software-mansion/react-native-gesture-handler/issues/1002

cant compile app on phone gap - new error with depriciation

I get the below errors in phonegap build. this is even when building an old version of the app that used to work. not understanding the error, any help??
Build Date: 2018-05-25 16:11:42 +0000
PLUGIN OUTPUT
Fetching plugin "cordova-plugin-inappbrowser" via npm
Installing "cordova-plugin-inappbrowser" at "3.0.0" for android
Fetching plugin "onesignal-cordova-plugin#^2.3.1" via npm
Installing "onesignal-cordova-plugin" at "2.4.1" for android
Subproject Path: CordovaLib
Fetching plugin "cordova-plugin-whitelist" via npm
Installing "cordova-plugin-whitelist" at "1.3.3" for android
This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do not need this plugin since the whitelist will be built in.
Fetching plugin "cordova-plugin-geolocation#^2.4.1" via npm
Installing "cordova-plugin-geolocation" at "2.4.3" for android
Fetching plugin "cordova-plugin-compat#^1.0.0" via npm
Installing "cordova-plugin-compat" at "1.2.0" for android
COMPILE OUTPUT
:wrapper
BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
Subproject Path: CordovaLib
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_3icce6xsgr7rsvstratajpe9b.run(/project/build.gradle:138)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
:preBuild UP-TO-DATE
:preReleaseBuild UP-TO-DATE
:checkReleaseManifest
:preDebugBuild UP-TO-DATE
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders
:CordovaLib:compileDebugShaders
:CordovaLib:generateDebugAssets
:CordovaLib:mergeDebugAssets
:CordovaLib:mergeDebugProguardFiles
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:compileDebugRenderscript
:CordovaLib:generateDebugResValues
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:CordovaLib:processDebugManifest
:CordovaLib:generateDebugBuildConfig
:CordovaLib:processDebugResources
:CordovaLib:generateDebugSources
:CordovaLib:incrementalDebugJavaCompilationSafeguard
:CordovaLib:compileDebugJavaWithJavac
:CordovaLib:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug
:CordovaLib:mergeDebugJniLibFolders
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug
:CordovaLib:bundleDebug
:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseShaders
:CordovaLib:compileReleaseShaders
:CordovaLib:generateReleaseAssets
:CordovaLib:mergeReleaseAssets
:CordovaLib:mergeReleaseProguardFiles
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:compileReleaseRenderscript
:CordovaLib:generateReleaseResValues
:CordovaLib:generateReleaseResources
:CordovaLib:packageReleaseResources
:CordovaLib:processReleaseManifest
:CordovaLib:generateReleaseBuildConfig
:CordovaLib:processReleaseResources
:CordovaLib:generateReleaseSources
:CordovaLib:incrementalReleaseJavaCompilationSafeguard
:CordovaLib:compileReleaseJavaWithJavac
:CordovaLib:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease
:CordovaLib:mergeReleaseJniLibFolders
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease
:CordovaLib:bundleRelease
:prepareAndroidArchCoreRuntime110Library
:prepareAndroidArchLifecycleLivedataCore110Library
:prepareAndroidArchLifecycleRuntime110Library
:prepareAndroidArchLifecycleViewmodel110Library
:prepareComAndroidSupportCustomtabs2711Library
:prepareComAndroidSupportSupportCompat2711Library
:prepareComAndroidSupportSupportCoreUi2711Library
:prepareComAndroidSupportSupportCoreUtils2711Library
:prepareComAndroidSupportSupportFragment2711Library
:prepareComAndroidSupportSupportMediaCompat2711Library
:prepareComAndroidSupportSupportV42711Library
:prepareComGoogleAndroidGmsPlayServicesBase1201Library
:prepareComGoogleAndroidGmsPlayServicesBaseLicense1201Library
:prepareComGoogleAndroidGmsPlayServicesBasement1201Library
:prepareComGoogleAndroidGmsPlayServicesBasementLicense1201Library
:prepareComGoogleAndroidGmsPlayServicesLocation1201Library
:prepareComGoogleAndroidGmsPlayServicesLocationLicense1201Library
:prepareComGoogleAndroidGmsPlayServicesTasks1201Library
:prepareComGoogleAndroidGmsPlayServicesTasksLicense1201Library
:prepareComGoogleFirebaseFirebaseCommon1201Library
:prepareComGoogleFirebaseFirebaseCommonLicense1201Library
:prepareComGoogleFirebaseFirebaseIid1201Library
:prepareComGoogleFirebaseFirebaseIidLicense1201Library
:prepareComGoogleFirebaseFirebaseMessaging1201Library
:prepareComGoogleFirebaseFirebaseMessagingLicense1201Library
:prepareComOnesignalOneSignal391Library
:prepareOrgApacheCordovaCordovaLib623ReleaseLibrary
:prepareReleaseDependencies
:compileReleaseAidl
:compileReleaseRenderscript
:generateReleaseBuildConfig
:generateReleaseResValues
:generateReleaseResources
:mergeReleaseResources
:processReleaseManifest
:processReleaseResourcesERROR: In FontFamilyFont, unable to find attribute android:font
ERROR: In FontFamilyFont, unable to find attribute android:fontStyle
ERROR: In FontFamilyFont, unable to find attribute android:fontWeight
FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':processReleaseResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
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: 2.249 secs
Error: /project/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
ERROR: In FontFamilyFont, unable to find attribute android:font
ERROR: In FontFamilyFont, unable to find attribute android:fontStyle
ERROR: In FontFamilyFont, unable to find attribute android:fontWeight
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':processReleaseResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
at ChildProcess.whenDone (/project/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
In your platforms/android folder that contains the build.gradle file, create another file called build-extras.gradle and put the following inside of it:
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
I had the same issue and this fixed it for me. I also had to update AndroidManifest.xml to point to the correct icon folder because it changed that config variable to the mipmap folders instead of the drawable folders.
Set your compileSdkVersion to 23 in your module's build.gradle file and see

Firebase Messaging Package for Unity gives problems when building with Gradle

At first I could build and install the app on my Android device but as I launched it crashed, the Logcat was saying that a Firebase library was not included in the package and advising to use the Play Services Jar Resolver. So I used it.
Now I have this error when trying to build my app. (excuse me, I had some issues understanding how to insert a code snippet :) )
CommandInvokationFailure: Gradle build failed.
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java -classpath "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-2.14.jar" org.gradle.launcher.GradleMain "assembleRelease"
stderr[
/Users/andreamarchetti/Desktop/Squarcuit/Temp/gradleOut/src/main/AndroidManifest.xml:4: Error: Avoid hardcoding the debug mode; leaving it out allows debug and release builds to automatically assign one [HardcodedDebugMode]
<application android:icon="#drawable/app_icon" android:label="#string/app_name" android:debuggable="false" android:isGame="true" android:banner="#drawable/app_banner">
Explanation for issues of type "HardcodedDebugMode":
It's best to leave out the android:debuggable attribute from the manifest.
If you do, then the tools will automatically insert android:debuggable=true
when building an APK to debug on an emulator or device. And when you
perform a release build, such as Exporting APK, it will automatically set
it to false.
If on the other hand you specify a specific value in the manifest file,
then the tools will always use it. This can lead to accidentally publishing
your app with debug information.
1 errors, 0 warnings
Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:591)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:546)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:528)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesWithDexForRelease'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java'' 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.
]
stdout[
Incremental java compilation is an incubating feature.
:preBuild UP-TO-DATE
:preReleaseBuild UP-TO-DATE
:checkReleaseManifest
:preDebugBuild UP-TO-DATE
:Firebase:preBuild UP-TO-DATE
:Firebase:preReleaseBuild UP-TO-DATE
:Firebase:compileReleaseNdk UP-TO-DATE
:Firebase:compileLint
:Firebase:copyReleaseLint UP-TO-DATE
:Firebase:mergeReleaseProguardFiles
:Firebase:packageReleaseRenderscript UP-TO-DATE
:Firebase:checkReleaseManifest
:Firebase:prepareReleaseDependencies
:Firebase:compileReleaseRenderscript
:Firebase:generateReleaseResValues
:Firebase:generateReleaseResources
:Firebase:packageReleaseResources
:Firebase:compileReleaseAidl
:Firebase:generateReleaseBuildConfig
:Firebase:mergeReleaseShaders
:Firebase:compileReleaseShaders
:Firebase:generateReleaseAssets
:Firebase:mergeReleaseAssets
:Firebase:processReleaseManifest
:Firebase:processReleaseResources
:Firebase:generateReleaseSources
:Firebase:incrementalReleaseJavaCompilationSafeguard
:Firebase:compileReleaseJavaWithJavac
:Firebase:processReleaseJavaRes UP-TO-DATE
:Firebase:transformResourcesWithMergeJavaResForRelease
:Firebase:transformClassesAndResourcesWithSyncLibJarsForRelease
:Firebase:mergeReleaseJniLibFolders
:Firebase:transformNative_libsWithMergeJniLibsForRelease
:Firebase:transformNative_libsWithSyncJniLibsForRelease
:Firebase:bundleRelease
:prepareAnimatedVectorDrawable2340Library
:prepareAppcompatV72340Library
:prepareCardviewV72340Library
:prepareCustomtabs2340Library
:prepareFacebookAndroidSdk4170Library
:prepareFacebookAndroidWrapper794Library
:prepareFirebaseAppUnity401Library
:prepareFirebaseCommon1100Library
:prepareFirebaseIid1100Library
:prepareFirebaseMessaging1100Library
:prepareFirebaseMessagingUnity401Library
:prepareGradleOutFirebaseUnspecifiedLibrary
:preparePlayServicesBase1100Library
:preparePlayServicesBasement1100Library
:preparePlayServicesTasks1100Library
:prepareSupportCompat2520Library
:prepareSupportCoreUi2520Library
:prepareSupportCoreUtils2520Library
:prepareSupportFragment2520Library
:prepareSupportMediaCompat2520Library
:prepareSupportV42340Library
:prepareSupportV42520Library
:prepareSupportVectorDrawable2340Library
:prepareReleaseDependencies
:compileReleaseAidl
:compileReleaseRenderscript
:generateReleaseBuildConfig
:mergeReleaseShaders
:compileReleaseShaders
:generateReleaseAssets
:mergeReleaseAssets
:generateReleaseResValues
:generateReleaseResources
:mergeReleaseResources
:processReleaseManifest
:processReleaseResources
:generateReleaseSources
:incrementalReleaseJavaCompilationSafeguard
:compileReleaseJavaWithJavac
:compileReleaseNdk UP-TO-DATE
:compileReleaseSources
:lintVitalRelease
:prePackageMarkerForRelease
:transformClassesWithDexForRelease
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
:transformClassesWithDexForRelease FAILED
BUILD FAILED
Total time: 45.841 secs
]
exit code: 1
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.Progress progress)
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, UnityEditor.Android.Progress progress)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.HostView:OnGUI()
I do not have - android:debuggable="false" -anywhere in any AndroidManifest.xml in my project.
I think the problem was that I had multiple .aar files of the same package but different versions. So Facebook SDK was conflicting with some Google Firebase stuff. I deleted the Facebook SDK .aar (which were older versions).

Gradle application variant mergeAssets not working

I'm trying to use the gradle applicationVariants mergeAssets task to remove some unused assets files from my apk.
Even though I'm able to print the line "this line is printed", when the application variant is 'run', the variant.mergeAssets.doFirst {} does not seem to be called, as I never see the output "this line is not printed" in my gradle console. The asset I'm trying to remove does not get removed either, but it seems like the code to remove it is never executed.
Am I doing something wrong? I've tried moving the entire android.applicationVariants task outside of buildTypes, I've tried nesting it in release{}.. nothing I've tried seems to work.
buildTypes {
release {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), file('proguard-project.txt')
signingConfig signingConfigs.release
}
publicBeta.initWith(buildTypes.release)
publicBeta {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), file('proguard-project.txt')
}
android.applicationVariants.all { variant ->
println 'this line is printed'
variant.mergeAssets.doFirst {
println 'this line is never printed'
File fonts = file("${rootDir}/build/intermediates/exploded-aar/com.github.johnkil.android-robototextview/robototextview/2.0.1/assets/fonts")
if (fonts.exists()) {
for (File file : fonts.listFiles()) {
if (file.getName().contains("RobotoSlab")) {
println("delete " + file.getName() + " font")
file.delete()
};
}
}
}
}
}
Here's the gradle console output, for brevity:
Executing tasks: [:shuttle_paid:assembleRelease]
Configuration on demand is an incubating feature.
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
this line is printed
this line is printed
this line is printed
:shuttle_library:compileLint
:shuttle_library:copyReleaseLint UP-TO-DATE
:shuttle_library:preBuild
:shuttle_library:preReleaseBuild
:shuttle_library:checkReleaseManifest
:shuttle_library:preDebugBuild
:shuttle_library:preDebugTestBuild
:libraries:castcompanionlibrary-android:compileLint
:libraries:castcompanionlibrary-android:copyReleaseLint UP-TO-DATE
:libraries:castcompanionlibrary-android:preBuild
:libraries:castcompanionlibrary-android:preReleaseBuild
:libraries:castcompanionlibrary-android:checkReleaseManifest
:libraries:castcompanionlibrary-android:preDebugBuild
:libraries:castcompanionlibrary-android:preDebugTestBuild
:libraries:castcompanionlibrary-android:prepareComAndroidSupportAppcompatV72000Library UP-TO-DATE
:libraries:castcompanionlibrary-android:prepareComAndroidSupportMediarouterV72000Library UP-TO-DATE
:libraries:castcompanionlibrary-android:prepareComAndroidSupportSupportV42000Library UP-TO-DATE
:libraries:castcompanionlibrary-android:prepareComGoogleAndroidGmsPlayServices5077Library UP-TO-DATE
:libraries:castcompanionlibrary-android:prepareReleaseDependencies
:libraries:castcompanionlibrary-android:compileReleaseAidl UP-TO-DATE
:libraries:castcompanionlibrary-android:compileReleaseRenderscript UP-TO-DATE
:libraries:castcompanionlibrary-android:generateReleaseBuildConfig UP-TO-DATE
:libraries:castcompanionlibrary-android:generateReleaseAssets UP-TO-DATE
:libraries:castcompanionlibrary-android:mergeReleaseAssets UP-TO-DATE
:libraries:castcompanionlibrary-android:generateReleaseResValues UP-TO-DATE
:libraries:castcompanionlibrary-android:generateReleaseResources UP-TO-DATE
:libraries:castcompanionlibrary-android:mergeReleaseResources UP-TO-DATE
:libraries:castcompanionlibrary-android:processReleaseManifest UP-TO-DATE
:libraries:castcompanionlibrary-android:processReleaseResources UP-TO-DATE
:libraries:castcompanionlibrary-android:generateReleaseSources UP-TO-DATE
:libraries:castcompanionlibrary-android:compileReleaseJava UP-TO-DATE
:libraries:castcompanionlibrary-android:extractReleaseAnnotations UP-TO-DATE
:libraries:castcompanionlibrary-android:mergeReleaseProguardFiles UP-TO-DATE
:libraries:castcompanionlibrary-android:processReleaseJavaRes UP-TO-DATE
:libraries:castcompanionlibrary-android:packageReleaseJar UP-TO-DATE
:libraries:castcompanionlibrary-android:compileReleaseNdk UP-TO-DATE
:libraries:castcompanionlibrary-android:packageReleaseJniLibs UP-TO-DATE
:libraries:castcompanionlibrary-android:packageReleaseLocalJar UP-TO-DATE
:libraries:castcompanionlibrary-android:packageReleaseRenderscript UP-TO-DATE
:libraries:castcompanionlibrary-android:packageReleaseResources UP-TO-DATE
:libraries:castcompanionlibrary-android:bundleRelease UP-TO-DATE
:shuttle_library:prepareComAndroidSupportAppcompatV72000Library UP-TO-DATE
:shuttle_library:prepareComAndroidSupportMediarouterV72000Library UP-TO-DATE
:shuttle_library:prepareComAndroidSupportSupportV42000Library UP-TO-DATE
:shuttle_library:prepareComGithubJohnkilAndroidRobototextviewRobototextview210Library UP-TO-DATE
:shuttle_library:prepareComGoogleAndroidGmsPlayServices5077Library UP-TO-DATE
:shuttle_library:prepareComLarswerkmanHoloColorPicker14Library UP-TO-DATE
:shuttle_library:prepareShuttleLibrariesCastcompanionlibraryAndroidUnspecifiedLibrary UP-TO-DATE
:shuttle_library:prepareReleaseDependencies
:shuttle_library:compileReleaseAidl UP-TO-DATE
:shuttle_library:compileReleaseRenderscript UP-TO-DATE
:shuttle_library:generateReleaseBuildConfig UP-TO-DATE
:shuttle_library:generateReleaseAssets UP-TO-DATE
:shuttle_library:mergeReleaseAssets UP-TO-DATE
:shuttle_library:generateReleaseResValues UP-TO-DATE
:shuttle_library:generateReleaseResources UP-TO-DATE
:shuttle_library:mergeReleaseResources UP-TO-DATE
:shuttle_library:processReleaseManifest UP-TO-DATE
:shuttle_library:processReleaseResources UP-TO-DATE
:shuttle_library:generateReleaseSources UP-TO-DATE
:shuttle_library:compileReleaseJava UP-TO-DATE
:shuttle_library:extractReleaseAnnotations UP-TO-DATE
:shuttle_library:mergeReleaseProguardFiles UP-TO-DATE
:shuttle_library:processReleaseJavaRes UP-TO-DATE
:shuttle_library:packageReleaseJar UP-TO-DATE
:shuttle_library:compileReleaseNdk UP-TO-DATE
:shuttle_library:packageReleaseJniLibs UP-TO-DATE
:shuttle_library:packageReleaseLocalJar UP-TO-DATE
:shuttle_library:packageReleaseRenderscript UP-TO-DATE
:shuttle_library:packageReleaseResources UP-TO-DATE
:shuttle_library:bundleRelease UP-TO-DATE
:shuttle_paid:preBuild
:shuttle_paid:preReleaseBuild
:shuttle_paid:checkReleaseManifest
:shuttle_paid:preDebugBuild
:shuttle_paid:prePublicBetaBuild
:shuttle_paid:prepareComAndroidSupportAppcompatV72000Library UP-TO-DATE
:shuttle_paid:prepareComAndroidSupportMediarouterV72000Library UP-TO-DATE
:shuttle_paid:prepareComAndroidSupportSupportV42000Library UP-TO-DATE
:shuttle_paid:prepareComGithubJohnkilAndroidRobototextviewRobototextview210Library UP-TO-DATE
:shuttle_paid:prepareComGoogleAndroidGmsPlayServices5077Library UP-TO-DATE
:shuttle_paid:prepareComLarswerkmanHoloColorPicker14Library UP-TO-DATE
:shuttle_paid:prepareShuttleLibrariesCastcompanionlibraryAndroidUnspecifiedLibrary UP-TO-DATE
:shuttle_paid:prepareShuttleShuttle_libraryUnspecifiedLibrary UP-TO-DATE
:shuttle_paid:prepareReleaseDependencies
:shuttle_paid:compileReleaseAidl UP-TO-DATE
:shuttle_paid:compileReleaseRenderscript UP-TO-DATE
:shuttle_paid:generateReleaseBuildConfig UP-TO-DATE
:shuttle_paid:generateReleaseAssets UP-TO-DATE
:shuttle_paid:mergeReleaseAssets UP-TO-DATE
:shuttle_paid:generateReleaseResValues UP-TO-DATE
:shuttle_paid:generateReleaseResources UP-TO-DATE
:shuttle_paid:mergeReleaseResources UP-TO-DATE
:shuttle_paid:processReleaseManifest UP-TO-DATE
:shuttle_paid:processReleaseResources UP-TO-DATE
:shuttle_paid:generateReleaseSources UP-TO-DATE
:shuttle_paid:compileReleaseJava UP-TO-DATE
:shuttle_paid:lintVitalRelease
:shuttle_paid:compileReleaseNdk UP-TO-DATE
:shuttle_paid:proguardRelease UP-TO-DATE
:shuttle_paid:dexRelease UP-TO-DATE
:shuttle_paid:processReleaseJavaRes UP-TO-DATE
:shuttle_paid:validateReleaseSigning
:shuttle_paid:packageRelease UP-TO-DATE
:shuttle_paid:zipalignRelease UP-TO-DATE
:shuttle_paid:assembleRelease
BUILD SUCCESSFUL
Total time: 8.682 secs
The line that is printed will always be printed because it gets executed in the configuration phase. ( see Gradle User Guide )
Your gradle console output shows all the merge*Resources tasks being skipped as UP-TO-DATE. This means that the inputs and the outputs have not changed since last time the tasks were executed, so gradle does not execute them again. Unfortunately, Gradle is not yet smart enough to know that you have changed the task implementation and that it should not skip the task.
Try running a clean to force the task to run

Categories

Resources