In android studio 1.3 i'm not able to run the entire test cases. I can run individual test cases without any issue but when i try to run all tests i get the following error:
Exception: java.lang.OutOfMemoryError thrown from the
UncaughtExceptionHandler in thread "Test worker" java.lang.OutOfMemoryError: PermGen space
I tried to increase my memory from the shell and also from android studio but its not helping at all.
JAVA_OPTS=-Xmx2048m -XX:MaxPermSize=768m
JAVA_TOOL_OPTIONS=-Xmx1024m -XX:MaxPermSize=512m -Xms512m
my tests are all mocked( i have a flavor called mocked) so i switch to the build variant mockDebug and then i run the following on terminal:
./gradlew :app:TestMockDebug
My tests are using robolectric as the test runner.
The other funny thing is if i go from the project explorer and right click ont he package containing the tests and do a "run tests in package ..." then it runs the tests. So my only problem is getting it to run from command line.
To resolve this out of memory exception i added more memory by setting shell environment variables as follows:
export JAVA_OPTS="-Xmx2048m -XX:MaxPermSize=768m"
export JAVA_TOOL_OPTIONS="-Xmx1024m -XX:MaxPermSize=512m -Xms512m"
Even though i had memory set in gradle.properties it looks like from the command line those properties are not seen. So the command line java options have to be set to increase the memory. if you check the terminal logs after doing this you'll see a line like this proving the same:
Picked up JAVA_TOOL_OPTIONS: -Xmx1024m -XX:MaxPermSize=512m -Xms512m
Related
I am getting the following exception when I enable lint with baseline file configuration.
> Lint infrastructure error
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
.........................
.........................
Caused by: java.lang.IllegalStateException: path must not be null
at com.android.tools.lint.XmlReporter.writeIssue(XmlReporter.kt:209)
at com.android.tools.lint.XmlReporter.writeIssues(XmlReporter.kt:113)
at com.android.tools.lint.XmlReporter.write(XmlReporter.kt:99)
at com.android.tools.lint.LintCliClient.run(LintCliClient.java:288)
I added following lintOptions in my module build.gradle
After which I ran lintDebug gradle task.
android{
lintOptions {
baseline file("lint-baseline.xml")
warningsAsErrors true
abortOnError true
}
}
I was expecting my changes to create lint-baseline.xml file in module root directory for the first run and fail the build indicating creation of lint-baseline.xml. For the second run the lint should read lint-baseline.xml and suppress the existing error/warning reporting.
But the first run creates empty lint-baseline.xml and fails with Lint infrastructure error. The subsequent runs did not produce Lint infrastructure error but because the file is empty, the comparison fails resulting in errors/warnings.
My app has both java and kotlin files.
This might not be the best answer, but I tried, adding an old output.json into the APK destination folder and tried to build a signed apk, then the error was known, in which we have to delete the output.json file. This time after building the APK, it worked.
Again on the other day, the above method failed, I tried deleting the release folder and creating the APK again. This time it worked.
i had this same issue, deleting the 'build' and 'release' folders. Somehow that worked for me. Don't know what actually caused it.
If the lint process successfully finished, you would get a appropriate result lint file. The error you get, shows the lint process has been failed in the first lint process run. After first run, the tools only read the empty file to determine the baseline. According to the reference you need manually delete the file and run lint process again to recreate it.
for more information you can use "Analyze > Inspect Code" in menu on the Android Studio IDE or use command line with command :
$ ./gradlew lintDebug
in both manner you can find the location of the lint-baseline.xml as output
...
Wrote XML report to file:///app/lint-baseline.xml
Created baseline file /app/lint-baseline.xml
pay attention if you use command line in the terminal of Android Studio, you must use Ctrl + Enter for running the command.
The output shows you a lot of useful information for debugging the problems.
I also faced the same issue and tried all solutions. Later, I realized there was an issue in a CSV plugin for Android Studio I installed. Since I disabled the plugin and restart the android studio, everything is working fine.
I have an Android Studio App that now has close to 100 "productFlavors" associated with it, of course all defined in the build.gradle. I would like to build them from command line since building them one at a time in the IDE would be a nightmare. My issue arises when I run into an error in the middle of building them using the command line gradlew.bat assembleRelease. Once I fix the error I would like to start building at the point of failure (maybe 50 flavors into the build) rather than at the beginning. Is there a way to do that with Gradle? With Ant I was forced to comment them out, I am hoping there is a better way with Gradle since the structure is much more complicated in the file.
UPDATE
I finally went with a solution that encompassed Gradle and Ant (yucky but it works). Basically I wanted to build on of my 100 White Label flavors, with a prefix of the version, and then copy it to the deliver APK without the version. To do this my ANT script looks like:
#!/bin/sh
DEPLOY_DIR=C:/AndroidBuilds/MyCompany.Build
VERSION="63"
NAME="WhiteLabel1"
DEPLOY_FOLDER="whitelabel1"
APK_NAME=$NAME$".apk"
gradlew assemble$NAME
cp $DEPLOY_DIR/$DEPLOY_FOLDER/$VERSION"-"$APK_NAME $DEPLOY_DIR/$DEPLOY_FOLDER/$APK_NAME
NAME="WhiteLabel2"
DEPLOY_FOLDER="whitelabel2"
APK_NAME=$NAME$".apk"
gradlew assemble$NAME
cp $DEPLOY_DIR/$DEPLOY_FOLDER/$VERSION"-"$APK_NAME $DEPLOY_DIR/$DEPLOY_FOLDER/$APK_NAME
This results in 2 APKs being generated, 63-WhiteLabel1.APK and 63-WhiteLabel2.APK, which are then copied to their respective deploy directories as WhiteLabel1.APK and WhiteLabel2.APK
I suppose if you are clever you could make this take parameters to run just the one you want, but Android Studio does a pretty decent job of that.
You can't specifically do that, but you can work around the issue and fix it with some script-magic.
If you have a build type called Release, and a flavor called Iron, you could run:
gradlew.bat assembleIronRelease
So you could write a script that would run through a loop of all flavors, and if it fails, it would tell you which one failed. You can then fix the error, and start the script again, telling it to start at X flavor (you would have to write the logic to tell it where to start though).
I am playing around with Instant Apps for Android.I installed all the correct packages and tired to create new Application with Instant App support (checked the box for Instant App when crating new application). The problem is that I always run into a problem with compile tools. Does anybody else have this problem and was able to find any workaround.
My environment:
Android Studio 3.0 Canary 1
Compile SDK: 25
Build Tools: "26.0.0 rc2"
Gradle plugin:3.0.0-alpha1
Gradle: tried both gradle-4.0-milestone1 and 2
Java 1.8/1.7
OS: tried both Windows 10 and Linux Ubuntu 16.4 LTS
The error:
Error: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
aapt2 compile -o /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/res/merged/androidTest/debug /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml
Issues:
- ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:520 invalid dimen
- ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:521 invalid dimen
- ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:568 invalid dimen
- ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:594 invalid dimen
- ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:595 invalid dimen
- ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:597 invalid dimen
- ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:598 invalid dimen
- ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:599 invalid dimen
- ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:600 invalid dimen
- ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:601 invalid dimen
- ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:602 invalid dimen
- ERROR: /home/simonp/Work/201705_InstantApp/InstantAppTest/feature/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:603 invalid dimen
:feature:mergeDebugAndroidTestResources FAILED
The line in question contains (520):
<item format="float" name="abc_disabled_alpha_material_dark" type="dimen">0.30</item>
Hopefully I provided enough information to you to resolve the problem. Thank you.
Below are mentioned four different solutions: A, B, C, and D; pick one that suites you:
A) Fixing Android Studio via Ubuntu .desktop launcher file
This is an Ubuntu-only alternative to the general approach on Fixing Android Studio (see below). Note that you may still want to implement the part about Fixing the shell, and perhaps even revert any modifications to studio.sh to fully confirm this fix.
I got tired of patching my studio.sh for every canary update, so I came up with a better solution that eliminates this step. It works on Ubuntu and simply involves creating a .desktop launcher that sets the sick environment variable in question.
Make a note of where your Android Studio 3 is installed, e.g. ~/opt/android-studio-3.
Prepare your local icon and applications directory, in case the don't already exist:
mkdir -vp ~/.local/share/icons ~/.local/share/applications
Create an Android Studio 3 icon that will make your launcher stand out from the default icon and save it into ~/.local/share/icons/android-studio-3.png. Or you can use the one I made by rubbing a piece of cheese on the original (~/opt/android-studio-3/bin/studio.png):
Create an Android Studio 3 launcher file by copy and pasting this into a shell:
cat <<-EOF > ~/.local/share/applications/android-studio-3.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Android Studio 3
Icon=android-studio-3
Exec=env LC_NUMERIC="en_US.UTF-8" opt/android-studio-3/bin/studio.sh "%f"
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-studio
EOF
Make it executable:
chmod +x ~/.local/share/applications/android-studio-3.desktop
Now for the tricky part. Ideally you should be able find, start, and create shorts for Android Studio 3 from the Dash:
But personally, I almost always have trouble getting Ubuntu to detect my new or changed .desktop files. One solution is to log out and back in again. If anyone knows how to force a rescan please let me know!
B) Fixing Android Studio start script
Here's an easy, elegant, and semi-permanent fix: Only change the locale of Android Studio itself by modifying its startup script:
Edit studio.sh e.g. ~/opt/android-studio/bin/studio.sh or whatever your installation path may be.
Somewhere at the top of the file, below #!/bin/sh and before the first lines of code appear, add this:
LC_NUMERIC="en_US.UTF-8".
Here's the top part of my studio.sh for completeness:
#!/bin/sh
#
# ---------------------------------------------------------------------
# Android Studio startup script.
# ---------------------------------------------------------------------
#
LC_NUMERIC="en_US.UTF-8"
message()
{
TITLE="Cannot start Android Studio"
...
Restart Android Studio
A note on Upgrading Android Studio or Gradle
When you later upgrade your Android Studio installation, it will detect that you've modified studio.sh. You should let the installer replace the file, and afterwards perform the patch again as described above. Finally restart Android Studio, and you'll be ready again. The other solutions are not affected by this.
C) Fixing the shell; Gradle, Jenkins, all that
Building from the shell using gradlew also requires the fix to be applied. This only affects the shell and not Android Studio. Pick one:
Either specify the the fix on every invocation like this:
LC_NUMERIC="en_US.UTF-8" ./gradlew clean assDebug
Or to make this permanent for the project, edit the gradlew file in the root of the project and somewhere at the top add this:
LC_NUMERIC="en_US.UTF-8"
Like here:
#!/usr/bin/env bash
################################################################################
##
## Gradle start up script for UN*X
##
################################################################################
LC_NUMERIC="en_US.UTF-8"
# Add default JVM options here. You can al...
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
...
Or you can of course also add a global and permanent fix though the use of an alias, gr:
cat <<EOF>>~/.bash_aliases
# Fixing Android Studio 3 Canary bug https://stackoverflow.com/a/44304075/2412477
alias gr='LC_NUMERIC="en_US.UTF-8" ./gradlew'
EOF
Note this is how bash shell aliases are added on Ubuntu; if you're on a different OS perhaps you should append to ~/.bashrc or ~/.profile instead.
Then start a new shell and now instead of invoking ./gradlew use the new alias gr:
gr clean assDebug
The clear disadvantage of #2 is that this has to be applied to all projects manually. The advantage, I think, is that this will automatically be overwritten when a new gradlew is installed, much like studio.sh gets replaced, so you get to test if the bug has been fixed =)
D) Disabling APPT2 all together
Personally I wouldn't do this, but I've added it for completeness since it definitely is a way to make appt2 stop giving errors. Add this line to your gradle.properties: android.enableAapt2=false
The workaround is to switch your development machine to a locale which uses "." as a decimal mark.
It can be changed the following way:
I solved this problem by adding the following line to the gradle.properties files
android.enableAapt2=false
This issue has been fixed in the newest Android Studio stable. Upgrading your Android Studio to 3.0 should solve this issue for you (also no need to disable AAPT2).
Make sure you are not adding any units(dp) when using format="float"
I was facing the same problem because I auto-generated dimens using Android Studio using Extract dimen resource and it added unit type like:
<item name="margin_top" type="dimen" format="float">51.75dp</item>
It should be:
<item name="margin_top" type="dimen" format="float">51.75</item>
add
maven{
url 'https://maven.google.com'
}
to repositories work for me
Required libraries for 64-bit machines:
If you are running a 64-bit version of Ubuntu, you need to install some 32-bit libraries with the following command:
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
If you are running 64-bit Fedora, the command is:
sudo yum install zlib.i686 ncurses-libs.i686 bzip2-libs.i686
Error:Failed to capture snapshot of output files for task 'transformClassesWithDexForDebug' property 'streamOutputFolder' during up-to-date check.
Failed to create MD5 hash for file 'C:\Users\GauravZone\AndroidStudioProjects\ZopporoStore\app\build\intermediates\transforms\dex\debug\folders\1000\10000\instant-run_83dbc65f4e3a4cd278807c089695c6b352698791\classes.dex'.
I am getting these errors don't know why, all application working fine earlier but suddenly getting this error in my all applications when try to run projects
Disable your antivirus, and it will work.
This is a Gradle issue and you can find it here.
So as of now just disable Instant Run.
It worked for me.
In android studio,
Open the Settings or Preferences dialog: On Windows or Linux, select File >
Settings from the menu bar. On Mac OSX, select Android Studio > Preferences from the menu bar.
Navigate to Build, Execution, Deployment > Instant Run.
Uncheck The box next to Restart activity on code changes.
I Solved this issue in my react-native project by removing all npm cache
1.npm cache clean --force
2.react-native run-android
Set multiDexEnabled true in your buildType release class in your build.gradle file
Error:Failed to capture snapshot of output files for task 'transformClassesWithDexForDebug' property 'streamOutputFolder' during up-to-date check ::
Solution: Just rebuild the project and then sync the project with Gradle files, as mention below.
1. Click on Build -> Rebuild Project
2. Click on Tools -> Android -> Sync Project with Gradle Files
I was also getting the same error.
But when i disabled Instant Run, Gradle started building.
But i agree with those who think this is a Gradle issue.
And until it gets resolve, disable Instant Run.
follows steps: instant run(file->setting->build,execution,deployment->uncheck instant run) then compile it work properly.
I've run into this issue after updating Android Plugin for Gradle to version 2.3.1. Rollback to version 2.3.0 helped for me, try setting
classpath 'com.android.tools.build:gradle:2.3.0' in your top level gradle.build file.
For me i had this error when i use my device as emulator . I did like that and it works :
1.adb reverse tcp:8081 tcp:8081
2.react-native start --reset-cache
3.react-native run-android
I faced the same issue and by disabling the QuickHeal Antivirus's virus protection, it worked for me fine.
Problem is gradle version. Update the gradle version to latest to resolve this kind of issues.
I have tried 'com.android.tools.build:gradle:3.3.2' is working for me. previously it was '3.1.0'
This issue comes when there are more than one process which is doing something with a file in your disk (whether it's your Jenkins job's workspace or Gradle's cache path or Gradle build folder that it creates) where these processes are trying to do something with a file and holds a lock.
If you have anti-virus, you may see this. Un-installing may resolve the issue but then you don't have anti-virus (it's better if you can set something in anti-virus to scan files periodically).
In my case, this issue only comes when I have a Jenkinsfile pipeline, where I'm running Gradle task for 3-5 projects in parallel (let's say Gradle is running an rpm task or build task) and when I'm running concurrent runs of this pipeline.
As you can see my pipeline code (Jenkinsfile Pipeline DSL: How to Show Multi-Columns in Jobs dashboard GUI - For all Dynamically created stages - When within PIPELINE section) is creating dynamic stage(s) and when I call it within pipeline section, I use parallel to run N no. of projects (that I can define in a hash/array) gradle tasks in parallel.
What I noticed is, all these runs (running in parallel) is running using my user-id (or some service account) and they are all using same Gradle version (4.3.1 in my case) and thus, they are using the same cache.
Running them in parallel alone --OR-- more realistic case would be running multiple pipeline runs of this pipeline job (running 5 project's gradle task in parallel) would probably land into this LOCK file condition.
You can probably solve this by setting a unique GRADLE_USER_HOME="~${WORKSPACE}/.cache"
(i.e. use Jenkins job's workspace which is dynamically created and is unique) or even better by setting Gradle user home as:
dt_stamp=`date +%s`; ## set and pass this dt_stamp variable for Gradle user home before calling Gradle.
GRADLE_USER_HOME="~${WORKSPACE}/${dt}/.cache"`
This way, at least in Gradle's cache, you won't see any issues due to lock files (NOTE: You'll not be able to efficiently use Gradle's cache concept of being lazy (or not fetching artifacts/library dependencies from a binary repository like Artifactory each time) while using Gradle among many projects if you set GRADLE_USER_HOME to a dynamic folder value as it'd be like running gradle after clearing it's cache each time (for some it's OK if your build doesn't take much time and it's more cleaner way to build as well)).
When I tried to run just one pipeline run (which runs all 5 project's gradle task in paralle), the pipeline succeeds all the time.
Running multiple instances of the pipeline job (running 5 parallel builds in each run) lands into this file LOCK issue.
Error mesg when I ran many concurrent pipeline runs (each pipeline run - runs Gradle tasks in parallel on 5 different projects).
FAILURE: Build failed with an exception.
* What went wrong:
Failed to capture snapshot of output files for task ':rpm' property 'archivePath' during up-to-date check.
> Timeout waiting to lock file hash cache (/view/user123456_Team_Tools/vobs/space/test/folder1/Project1of5/.gradle/4.3.1/fileHashes). It is currently in use by another Gradle instance.
Owner PID: 29003
Our PID: 903
Owner Operation:
Our operation:
Lock file: /view/user123456_Team_Tools/vobs/space/test/folder1/Project1of5/.gradle/4.3.1/fileHashes/fileHashes.lock
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
-- OR --
You may also get this kind of error where a process is not able to delete a directory (while Gradle is in progress as the target folder/file may be in use by some other process)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':clean'.
> Unable to delete directory: /view/user123456_Team_Tools/vobs/space/test/folder1/project2of5/build/classes/java/main/org/syntax/jedit
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
If you are really lucky (like me), then you'll probably hit this error as well:
Jenkins - java.lang.IllegalArgumentException: Last unit does not have enough valid bits &
Gradle error: Task 'null' not found in root project
See here for more details: Jenkins - java.lang.IllegalArgumentException: Last unit does not have enough valid bits & Gradle error: Task 'null' not found in root project
Clearing the cache does fix it. But only once, if you stop the project and re run it, you ll end up with same error again.
Doing following fixes it for me,
cd android
./gradlew clean
react-native start --reset-cache
npm clean cache --force
Next, open two different terminals,
Run react-native start
in one terminal and in second,
Run react-native run-android
Hope it'll work for you as well.
Just updated to Android Studio 0.8.2 and I'm suddenly getting ClassNotFoundException on launch for the main activity when one of my apps is built with 0.8.2.
The app is in version control (Git) so I've checked out old builds and they are now exhibiting the same symptom upon execution and they were definitely working just fine when built with 0.8.1.
I've tried clean rebuilds, gradle syncing, manually deleting build/ and, .gradle/ dirs, closing & reopening Android Studio etc. - I've checked out various old builds of my project and tested the APK on several Android devices, the issue is 100% reproducible with both Debug and Release builds.
Strangely, although this is 100% reproducible for this particular project, I have another project which is building and executing just fine.
I've pulled apart the APK that is output from Android Studio 0.8.2 with apktool, and the class is definitely there.
$ pwd
/Users/ben/Development/go-android/Go/build/outputs/apk/Go-debug/smali/au/com/glassechidna/go/content
$ ls
AddTripFragment$1.smali CreateTripFragment$OnQueryTextListener$1.smali CreateTripFragment.smali MainActivity.smali
AddTripFragment.smali CreateTripFragment$OnQueryTextListener.smali GoActivity.smali TrainTimeFragment$1.smali
CreateTripActivity.smali CreateTripFragment$OnSuggestionListener.smali GoApplication.smali TrainTimeFragment.smali
CreateTripFragment$1.smali CreateTripFragment$StopCursor.smali MainActivity$PagerAdapter.smali TripFragment.smali
Stacktrace: https://gist.github.com/Benjamin-Dobell/a77bd8fffb03ddb37ff1
Manifest: https://gist.github.com/Benjamin-Dobell/ca7ee54d7562a0feab0c
Go/build.gradle[1]: https://gist.github.com/Benjamin-Dobell/f9a3a39d6f141e412dac
build.gradle[1]: https://gist.github.com/Benjamin-Dobell/2db744dd89e487325b65
MainActivity.java[2]: https://gist.github.com/Benjamin-Dobell/11a6335f56b6ababeeb4
Any ideas?
[1] Taken from one of the oldest commits, as it has less dependencies etc. cluttering stuff up. However, the issue is still 100% reproducible for this commit.
[2] Just the declaration.
Cleaning from CLI seems to have resolved the issue.
Props to #yogurtearl for pointing me in the right direction.
$ ./gradlew clean
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
:Go:clean
BUILD SUCCESSFUL
Total time: 3.906 secs
$ ./gradlew assembleDebug
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
:Go:preBuild
:Go:compileDebugNdk
:Go:preDebugBuild
:Go:checkDebugManifest
:Go:preReleaseBuild
:Go:prepareComAndroidSupportSupportV42000Library UP-TO-DATE
:Go:prepareDebugDependencies
:Go:compileDebugAidl
:Go:compileDebugRenderscript
:Go:generateDebugBuildConfig
:Go:generateDebugAssets UP-TO-DATE
:Go:mergeDebugAssets
:Go:generateDebugResValues UP-TO-DATE
:Go:generateDebugResources
:Go:mergeDebugResources
:Go:processDebugManifest
:Go:processDebugResources
:Go:generateDebugSources
:Go:compileDebugJava
:Go:preDexDebug
:Go:dexDebug
:Go:processDebugJavaRes UP-TO-DATE
:Go:validateDebugSigning
:Go:packageDebug
:Go:zipalignDebug
:Go:assembleDebug
BUILD SUCCESSFUL
Total time: 10.64 secs
$ adb uninstall au.com.glassechidna.go.debug
Success
$ adb install Go/build/outputs/apk/Go-debug.apk
8553 KB/s (323343 bytes in 0.036s)
pkg: /data/local/tmp/Go-debug.apk
Success
Update
Since running the gradlew commands above I can now clean and build just fine in Android Studio. Consequently, it would seem that Android Studio wasn't cleaning properly and that manually deleting build/ and .gradle/ directories wasn't sufficient either.
Now, I just need to understand why this worked and why cleaning and building in Android Studio didn't...
If you know about any additional state gradle/gradlew stores elsewhere that could be the culprit, I'd love to hear about it via a comment.
Update 2
This issue has kept occurring for me on my Mac. I've noticed that when I build in Android Studio the "preDexDebug" task generated several warnings as follows:
objc[49452]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
Comparing a good APK and a bad one I could see that some of the generated DEX'd classes vary quite significantly between the two APKs. Unfortunately I don't yet know a solution to the problem (I'm stuck building with the Gradle Wrapper from CLI).