This repo contains information that is common to all Novoda's Open Source projects.
novoda / gradle-android-command-plugin Goto Github PK
View Code? Open in Web Editor NEWHandy commands for testing Android on CI
License: Other
Handy commands for testing Android on CI
License: Other
Issue by grujo
Tuesday Apr 22, 2014 at 17:32 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/pull/13
grujo included the following code: https://github.com/novoda/legacy-gradle-android-command-plugin/pull/13/commits
Print the current activity stack via wrapping
adb shell dumpsys activity | grep -i run
see http://stackoverflow.com/questions/4387875/view-activity-stack-in-android
Issue by devisnik
Tuesday Feb 04, 2014 at 09:50 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/issues/6
The uninstall task suffers the same flaws as the install task when multiple devices are connected.
We should roll our own task here as well.
Currently I think monkey configuration is not clean and confusing.
There are currently 3 ways to modify the behavior of the monkey task.
task('monkey2', com.novoda.gradle.command.Monkey) {
categories {
['android.intent.category.ONLY_ME']
}
}
As it can be seen here, it doesn't look very good and you need to have another task name. Because monkey
is taken.
command {
events 1000
categories = ['android.intent.category.ONLY_ME']
}
Although it looks clean, having these configurations in the parent command
closure doesn't make sense to me because they are only valid for the task monkey
-Pcategories
My suggestion is to remove closures from the Monkey
task and have a method in the main extension named monkey
which will allow users to define the properties with something like this
command {
monkey {
events 1000
categories = ['android.intent.category.ONLY_ME']
}
}
I don't know why it is really bug.
But in the VariantConfigurator.groovy
you are using variant.outputs[0].packageApplication.outputFile
as source for the final APK which will be deployed to the phone.
But if I use this to the remote sign:
https://gist.github.com/ducrohet/e0d854c54bd0ceeb7044
output[0].packageApplication.outputFile
contain only usigned apk.
But real target name is output[0].outputFile
So why you are using packageApplication.outputFile
instead?
Issue by charroch
Monday Mar 31, 2014 at 17:32 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/issues/11
DeviceProvider is the standard Android plugin way to get a device which implements IShellExecutable. We could use that to execute the commands rather then adb
Thank you for the plugin!
I have a question which I was not able to grab from sources or documentation. Is log from monkeyrunner collected somewhere?
This would make sure both installation of the app and the monkey run on the same device
Tablets can run out of battery when the brightness is full and the monkey runner has a nasty habit of turning it up to full.
It would be good if we could change these values -brightness, volume etc after the monkey has ran.
Also links #57 as the commands will probably adb shell prop edits
Using plugin with Genymotion:
task autoLogin (type: com.novoda.gradle.command.Input) {
script {
text 'user'
tab()
text 'password'
enter()
enter()
Adds quotes to the text that appeared in text fields
Issue by devisnik
Tuesday Apr 22, 2014 at 13:37 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/pull/12
Note: renames the task creation methods from tasks
to task
.
devisnik included the following code: https://github.com/novoda/legacy-gradle-android-command-plugin/pull/12/commits
The gradle output isn't too helpful!
Caused by: groovy.lang.GroovyRuntimeException: Monkey run failed
at com.novoda.gradle.command.Monkey.handleCommandOutput(Monkey.groovy:12)
at com.novoda.gradle.command.AdbTask.runCommand(AdbTask.groovy:48)
at com.novoda.gradle.command.AdbTask.assertDeviceAndRunCommand(AdbTask.groovy:42)
at com.novoda.gradle.command.Monkey.exec(Monkey.groovy:17)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:218)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:579)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:562)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 47 more
Issue by devisnik
Tuesday Jan 28, 2014 at 11:52 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/pull/3
A failing monkey did not let the build fail, this should fix that.
We also let the sample crash on menu selection so monkey behaviour on failure can be observed.
devisnik included the following code: https://github.com/novoda/legacy-gradle-android-command-plugin/pull/3/commits
Please add support for testVariants so we can install the test apks and maybe start instrument tests via the android-command-plugin
Please add this to https://plugins.gradle.org.
Issue by devisnik
Tuesday Feb 04, 2014 at 13:47 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/pull/7
Adds an uninstall task that specifies a device id to handle multiple connected devices.
This fixes #6
devisnik included the following code: https://github.com/novoda/legacy-gradle-android-command-plugin/pull/7/commits
Hello,
I don't see a license anywhere in this code. Did I miss it? I'd like to contribute but the legal department at my company has a problem with me using 3rd party source when permission hasn't been explicitly granted. Are you using an open source license? If not can you email me permission to use this source?
I have two new tasks that are ready for a pull request. I have a Pulll task to grab files from the device and a Logcat task to collect device logs for the duration of a task (like connectedAndroidTest).
thanks,
Tim
Issue by grujo
Thursday Apr 24, 2014 at 09:48 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/pull/15
...command on a device.
This way we always know where did the issue occur.
grujo included the following code: https://github.com/novoda/legacy-gradle-android-command-plugin/pull/15/commits
Issue by rciovati
Tuesday Jan 28, 2014 at 08:55 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/pull/2
With this commit the run
and monkey
tasks will depend from the install
task.
I've also updated libs & tools versions in the sample app.
rciovati included the following code: https://github.com/novoda/legacy-gradle-android-command-plugin/pull/2/commits
There is a property to access adb executable: http://stackoverflow.com/a/34538979/243599
Issue by stefanodacchille
Saturday Mar 29, 2014 at 08:35 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/pull/10
I'm not entirely happy with the API atm, I'd have loved to have a configuration closure instead, something like:
command {
...
push {
localFile 'img.jpg'
remoteFile 'sdcard/Pictures/img.jpg
}
}
but I'm not sure how to implement this. If anyone can give me any inputs on how to achieve it, I'd be happy to put more work on it.
stefanodacchille included the following code: https://github.com/novoda/legacy-gradle-android-command-plugin/pull/10/commits
As mentioned here http://developer.android.com/tools/help/monkeyrunner_concepts.html
The monkeyrunner tool is not related to the UI/Application Exerciser Monkey, also known as the monkey tool.
So instances of text like calls the monkeyrunner on the specified device
should refer instead to monkey
, since that's what the plugin uses.
The problem is that it simply does not accept the argument -rd
when r and d are together. -r -d
works.
As far as I see, it is only on Nougat (both my Nexus 6 and emulator). It could be because of the many changes/refactorings they did on adb
on Nougat.
Exception occurred while dumping:
java.lang.IllegalArgumentException: No argument expected after "-rd"
at android.os.ShellCommand.getNextOption(ShellCommand.java:195)
at com.android.server.pm.PackageManagerShellCommand.makeInstallParams(PackageManagerShellCommand.java:999)
at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:139)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:94)
at android.os.ShellCommand.exec(ShellCommand.java:94)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:18167)
at android.os.Binder.shellCommand(Binder.java:468)
at android.os.Binder.onTransact(Binder.java:367)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2387)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:3143)
at android.os.Binder.execTransact(Binder.java:565)
Currently, using plugindev holds back further releases of this plugin.
Hence, better revert #77
Issue by rciovati
Wednesday Feb 12, 2014 at 08:48 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/pull/9
rciovati included the following code: https://github.com/novoda/legacy-gradle-android-command-plugin/pull/9/commits
Related to pull request #42, in the main plugin class, it seems that the plugin tries to warn users if the Android plugin hasn't been applied.
But since ProjectConfigurationException
seems to require both a String
and a Throwable
, the plugin just fails in this case with the message:
Could not find matching constructor for: org.gradle.api.ProjectConfigurationException(java.lang.String)
Issue by devisnik
Monday Feb 03, 2014 at 15:10 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/pull/5
use custom install task named 'push' instead of relying on android gradle plugin's install task.
This fixes #4
devisnik included the following code: https://github.com/novoda/legacy-gradle-android-command-plugin/pull/5/commits
I think that default behavior should run app on all attached device, not just first, why?
installDebug will also install app on all attached device
Add by default some filter on the device.sdkVersion, some similar to
def minSdkDevices = devices().grep({
it.sdkVersion() >= defaultConfig.minSdkVersion.getApiLevel()
})
I know that's a bad place to ask questions... but I can't find better place:)
Could you explain a little how to:
I found that I could do
command {
deviceId "deviceName"
}
But how to pass those in commandLine
Sometimes can be very usefull possibility to call adb command manually by build script, without define task. Like this plugin https://github.com/michel-kraemer/gradle-download-task can do with donwload {}
construct.
Issue by grujo
Wednesday Apr 23, 2014 at 14:01 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/pull/14
Set the APK path lazily. Useful if the output file name changes during the build process.
grujo included the following code: https://github.com/novoda/legacy-gradle-android-command-plugin/pull/14/commits
I'm trying to import project to IntelliJ but without luck. I even created an issue on IntelliJ issue tracker:
https://youtrack.jetbrains.com/issue/IDEA-132303
First of all I don't understand why importing is running tests and failing the IDEA. Is it gradle plugin specific or it is fault of IDE?
Another question of course why gradle doesn't see Environment variable. I tried to switch off daemon running.
Can you help? What IDE do you use for development?
Something so you don't have to use adb shell
Grant or revoke one or more permissions:
$ adb shell pm [grant|revoke] <permission-name> ...
I am seeing an issue on Lollipop and up, where the plugin installs the application for "all users". This forces me to do:
./gradlew uninstallAll
or manually go into the phones Settings and view the applications and manually "uninstall for all users".
It's a small thing but the commands show up as "others" when you call gradle(w) tasks
I guess there's a group ID missing or something.
Issue by devisnik
Wednesday Feb 05, 2014 at 09:39 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/issues/8
Although I did not test this I suppose that the plugin does not work on Windows since the executable names are hardcoded.
Issue by devisnik
Monday Feb 03, 2014 at 15:00 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/issues/4
The install task of the gradle android plugin does not handle multiple attached devices.
(see https://groups.google.com/forum/#!msg/adt-dev/uUcw-HG49oE/Aa6VyijruL8J)
We should use our own install task by default.
We're using variant.getPackageApplication()
which is now deprecated!
The warning when trying to build is
WARNING [Project: :sample] variant.getPackageApplication() is deprecated. Call it on one of variant.getOutputs() instead.
Especially for a beginner it is not clear which tasks came from where, and how to configure them.
Tasks description should include GACP or some other note to distinguish
Related to #108 and #110, I found this conversation and discussed a little bit with @keyboardsurfer about the implications of -d
flag in adb install
https://plus.google.com/u/0/+BenjaminWeiss/posts/Pq1Pr1vy9kE
I can see that it was added as a side-effect commit in another PR that is not really related.
I couldn't find any explanation why we needed this.
I think, we also shouldn't have it on by default. It can be dangerous when you checkout a very old commit to test something. The downgrade can cause un-expected problems with the persisted data.
We should instead maybe have a sample that shows how to enable this if wanted.
Expose in the api the ability to provide the monkey package/action/activity start parameters
adb shell am start in order to start the desired subactivity
adb shell am start -a my.package.app.ACTION1 -n my.package.app/.sub.MyActivity
It looks like the plugin works also on the new version of the android gradle plugin, only with this warning
WARNING [Project: :app] variant.getPackageApplication() is deprecated. Call it on one of variant.getOutputs() instead.
Issue by grujo
Friday Apr 25, 2014 at 10:18 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/issues/16
Something like https://gist.github.com/xrigau/11284124
I believe the plugin needs more documentation.
In the README file, only the tasks are mentioned. Some of the configurations can be seen in the sample project.
Ideally, these can also be in the README or a wiki file.
Things that can go there:
-DdeviceId
devices()
, device.brand()
etc.lets find out
Issue by devisnik
Friday Jan 17, 2014 at 13:04 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/pull/1
Introduces tasks for the different commands. Properties are managed by the extension to enable configuration via
variant {
deviceId '123456'
}
This reduces the definition overhead in the applying project. (Could be further reduced now by registering the tasks during plugin registration).
Note that the device name is no longer used in the automatic task naming.
I've also included the files under buildSrc
from my local dev environment for easier testing. It expects a link to the plugin source named command
.
devisnik included the following code: https://github.com/novoda/legacy-gradle-android-command-plugin/pull/1/commits
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.