I get this error when I run gradle test:
Caused by: org.gradle.api.GradleException: Could not generate test report to '/home/tjwebb/workspace/MyProject/build/reports/tests'.
Groovy 1.7.10
Gradle 1.0-m3
The weird thing is that my tests compile and run perfectly, they pass, and I get the usual output in build/reports/tests. Any ideas?
I guess this was a bug. I upgraded to gradle 1.0-m9 and it works. For some reason, m3 is the version still in the Ubuntu repositories.
Related
When i run flutter run --release -v this command below error came
Caused by: java.lang.IllegalAccessError: Interface androidx.lifecycle.b implemented by class
com.mr.flutter.plugin.filepicker.FilePickerPlugin$LifeCycleObserver is inaccessible (declaration of 'com.mr.flutter.plugin.filepicker.FilePickerPlugin$LifeCycleObserver' appears in
/data/app/app.projects.xxx.mobile-1/base.apk)
My Gradle is
classpath 'com.android.tools.build:gradle:4.0.0' //4.0.1 //3.3.2 //3.5.3 //3.4.2
distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip
This worked for me.
Go to build.gradle file at android/gradle and downgrade to version 3.6.2 like shown below,
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
Answer taken from this thread.
I had similar issue, its related to gradle 4+ version i guess, i was able to resolve this by following below steps.
Add bellow line to app/proguard-rules.pro (if file not present create one.)
-keep class androidx.lifecycle.DefaultLifecycleObserver
Error from logcat, it was only having issue in release build. The emulator was working fine. -
03-12 07:41:32.281 22847 22847 E AndroidRuntime: java.lang.IllegalAccessError: Interface androidx.lifecycle.b implemented by class com.mr.flutter.plugin.filepicker.FilePickerPlugin$LifeCycleObserver is inaccessible (declaration of 'com.mr.flutter.plugin.filepicker.FilePickerPlugin$LifeCycleObserver' appears in base.apk)
Related Discussion/Issue can be found here -https://github.com/flutter/flutter/issues/58479
upgrade your grade classpath and distribution url to latest version.
also filepicker to latext version in pubspec.yaml
check if it works... if not then open android/gradle.properties and see if the following lines are there or not if not then add
android.useAndroidX=true
android.enableJetifier=true
check if following are there in your android/app/build.gradle or not
minSdkVersion 21
targetSdkVersion 28
multiDexEnabled true
then flutter clean
then instead of directly running flutter run --release -v use the following its not related to your issue but it will cause another you will get something missingFile exception.
flutter build apk --debug
then flutter build apk --profile;
then flutter build apk --release;
I updated Android Studio to version 3 and since then all my spock tests, when in a java module, do not run when trying to run them from inside the application (right click on groovy folder -> Run 'Tests in groovy'). I get a:
Class not found: "package.name.classname"Empty test suite."
Same if I try to run a single test.
If I run the test task from the gradle panel I get this:
error. Cause: unknown.
On the other hand:
Any spock tests in android modules run fine.
All my java tests in all my modules run fine.
All my tests (spock and java) run fine when running them from outside AS using gradle (gradlew clean test).
My setup:
gradle v4.1
android gradle plugin v3.0.0
java version compatibility v1.8
in my java modules i use the gradle groovy plugin
in my android modules i use the groovy android gradle plugin
A few things I tried after searching in both google and here:
changing the android gradle plugin back to v2.3.3 and gradle to v3.3
trying to copy all groovy classes to build/classes/java/test
So this is more of a workaround than an actual solution but it should give you your debugger back which is probably 90% of the value anyway:
You can run your test suite like:
./gradlew <module>:test --debug-jvm
And the jvm running your tests will suspend until a debugger attaches.
From Android Studio bring up the action chooser by pressing ctrl + shift + a (on linux anyway, check the equivalent for your OS) and select:
Attach to local process...
Once Android Studio attaches the tests will begin running.
The --debug-jvm flag can be used together with --tests to debug an individual test:
./gradlew <module>:test --tests fully.qualified.test.Test --debug-jvm
I'm going through the kotlin koans repo (https://github.com/kotlin/kotlin-koans). Whenever I make changes to my .kt files and run the unit tests, the changes in the .kt files aren't reflected in the test results. I've been getting around this by running ./gradlew build before running the unit tests.
I'm using Android Studio as my IDE. Any idea what's happening?
There is bug in Android studio.
https://github.com/Kotlin/kotlin-koans/issues/90
https://youtrack.jetbrains.com/issue/KT-18948
When you are running test, project doesn't recompile.
You should build project and then run tests again.
I've got an Android Studio project and have been building it just using Build/Rebuild Project - and it builds fine.
However I'm making additions to the build.gradle file and am having an issue using AS as often the output in the Gradle Console within AS just vanishes. This means if I've made a mistake with the build.gradle additions I can't see what the problem is.
So I thought I'd run things from the command line. So I just type 'gradle' from my mac's terminal window but I get this:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Gradle version 2.2 is required. Current version is 2.10. If using the gradle wrapper, try editing the distributionUrl in /Users/Cequint/Desktop/CityIDGradle/android/CityID/gradle/wrapper/gradle-wrapper.properties to grade-2.2-all.zip
The gradle-wrapper.properties file in AS contains this:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
Yet if I type 'gradle -version' from the command line it shows I have Gradle 2.10 installed.
I tried changing the cradle-wrapper.properties file in AS to contain grade-2.2-all.zip as it said in the error message, but it made no difference.
I also tried changing it to be grade-2.10-all.zip but its still the same error message.
So the question is:
1) what can I update in the AS gradle files to build from the command line?
2) If I have a different version of gradle downloaded onto the mac, than got installed with AS. How can I download the version with AS to be the same i.e. to be v2.10?
When you run gradle from the command line, it invokes gradle from your system path, which apparently is gradle 2.10
When you add a wrapper section to your gradle.build file, as is the case with Android Studio projects, you will see a gradlew.bat and a gradlew shell script in the project root folder. These scripts will invoke (and download if required) the version of gradle defined in your wrapper section.
TL;DR: Run ./gradlew instead of gradle
I have an Android project that requires the Jsoup library. I've tried everything I can think of to get the jar shaded into the APK.. I just can't get it working. Logcat tells me:
FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: org.jsoup.Jsoup
Does anyone know how to include/shade a maven artifact into an APK with Android Studio?
I have found the answer. The trick is to append ":sources". See an example here: http://www.alonsoruibal.com/my-gradle-tips-and-tricks/
I have seen the same type of error every time someone else adds a library with Gradle. Build is usually successful but app crashes when it tries to use the new library. Running task clean with Gradle helps.