This class in the build/intermediates/classes/debug/ target
If there is a way (such as a plug-in) to add classpath to build/intermediates/classes/debug/
Related
everyone. I'm using gradle version 5.6.2. I updated my android studio project dependencies like this:
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
classpath "com.google.firebase:perf-plugin:1.3.1"
}
I apply the plugins like this:
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'com.google.gms.google-services'
But now when I compile my project this error shows up:
Illegal class file: Class module-info is missing a super type. Class file version 53. (Java 9)
It says the problem is in app\build\intermediates\transforms\FirebasePerformancePlugin\bus\debug\9\module-info.class
Inside there's this:
module com.google.gson {
requires transitive java.sql;
exports com.google.gson;
exports com.google.gson.annotations;
exports com.google.gson.reflect;
exports com.google.gson.stream;
}
My guess is that firebase started using Java 9 but my project is currently working with Java 8. I tried changing the version to 9 but I get this error:
Could not target platform: 'Java SE 9' using tool chain: 'JDK 8 (1.8)'.
This is a bug in the Android Gradle plugin, fixed now in Android Studio 3.6. It looks to only be an issue on Windows, as the path format uses the backslash \ instead of forward slash /. I confirmed I am able to build my app on Android Studio 3.5 on Linux, but not Windows.
It was solved temporarily by adding this to build.gradle :
debug {
FirebasePerformance {
// Set this flag to 'false' to disable #AddTrace annotation processing and
// automatic HTTP/S network request monitoring
// for a specific build variant at compile time.
instrumentationEnabled false
}
}
I am using Android Data Binding, and while things were simple it was working very well. However, once I added a BindingAdapter annotation, my project stopped building in Android Studio with an error Execution failed for task ':app:compileSaferesourceDebugJavaWithJavac', but it didn't give me any more detail. Running gradlew build on the command line showed that the actual error was java.lang.ClassNotFoundException: javax.xml.bind.JAXBException. This makes sense, because this development machine has only Java 11 installed, not Java 8.
I found this answer, which says to add the following dependencies to gradle:
implementation "javax.xml.bind:jaxb-api:2.2.11"
implementation "com.sun.xml.bind:jaxb-core:2.2.11"
implementation "com.sun.xml.bind:jaxb-impl:2.2.11"
implementation "javax.activation:activation:1.1.1"
The problem I have is that I don't know where to add them. Adding them as implementation dependencies to the app/build.gradle doesn't work, because JAXB is a dependency of the build tools, not of my application itself.
I tried adding them as buildscript.dependencies too, but that didn't work either:
buildscript {
repositories {
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "javax.xml.bind:jaxb-api:2.3.1"
classpath "com.sun.xml.bind:jaxb-core:2.3.0"
classpath "com.sun.xml.bind:jaxb-impl:2.3.1"
classpath "javax.activation:activation:1.1.1"
}
}
I also tried adding them as buildscript.dependencies in the project root build.gradle file, but that also did not help:
buildscript {
repositories {
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "javax.xml.bind:jaxb-api:2.3.1"
classpath "com.sun.xml.bind:jaxb-core:2.3.0"
classpath "com.sun.xml.bind:jaxb-impl:2.3.1"
classpath "javax.activation:activation:1.1.1"
}
}
I know that I can use Java 8 to build this code, but I really don't want to have to deal with multiple Java versions and I have other projects that require Java 11.
Is there a place in the gradle configuration that I can put these build dependencies to get them to work?
Configurations I tested:
Operating Systems: Tested on Windows 10 and Windows Server 2016
Build Environments: Tested in Android Studio 3.4.1, Android Studio 3.5.0-beta04, and using Gradle Wrapper on the command line
Android Gradle Plugin: tested with 3.4.1 and 3.5.0-beta04
Android Build Tools: tested with 28.0.3 and 29.0.0
Note: comment asks for Databinding version, which is no longer relevant since Databinding is now built-in and does not have a separate version number.
Fail with error show above:
Java 11.0.1 x64
Working properly:
Java 1.8.0_212 x64
After extensive testing, it is clear that the Java version is the only thing that makes any difference here.
UPDATE As of 2020-07-21, the Android bug tracker now states:
Studio will also start using JDK 11 starting in 4.2, approx in 1 to 2 months.
According to a member of the Android Project on the Android Bug Tracker as of 2019-03-07:
Java 11 is not supported by Android studio and its tools.
I am using android studio 3.2.1 and Kotlin 1.2.71
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71'
for almost time whenever I build project getting below errors with respect to Kotlin classes name and object references
Eg: class DelUserIP
Unresolved reference: DelUserIP
: Cannot access class ‘input.DelUserIP’. Check your module classpath for missing or conflicting dependencies
but after an error, if I build project once again it will be success build without error after some build again I am experiencing same above error…
after renaming my package name of data classes from name "module" to some other name,then i didn't experienced issue again.
I am trying to use Floating Action Button(FAB) in my application.
However, when I am declaring the same I get the error:
android.support.design.widget.FloatingActionButton could not be instantiated.
I have added following commands to my gradle file:
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
I have also tried with adding following to my style parent:
parent="#style/Theme.AppCompat"
Also tried having my Activity class extend Activity as well as AppCompatActivity.
Am I missing something? Pls. help
Android build system uses the Android Plugin for Gradle to support
building Android applications with the Gradle build toolkit. The
plugin runs independent of Android Studio so the plugin and the Gradle
build system can be updated independently of Android Studio.
For FloatingActionButton requirement
Please update your classpath
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
Must have :
compileSdkVersion 23
&
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
Updated 21.06.2015
I wanna try kotlin and android databinding in a same project. But when I add to kotlin-gradle-plugin dependency I cannot build even an empty project anymore with error:
cannot generate view binders java.lang.NoClassDefFoundError: kotlin/jvm/internal/ExtensionFunctionImpl
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0-beta3'
classpath "com.android.databinding:dataBinder:1.0-rc0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:0.12.613"
}
}
Any workaroud to make it work together?
Unfortunately,this is caused by a kotlin version inconsistency between databinding and kotlin plugin.
We'll remove kotlin dependency from the plugin on rc1 but until then you would need to use kotlin 0.11.91.
Also, since kotlin's annotation processor support is limited at this moment and data binding is using annotation processor; they probably won't work well (though I have not tried).