Intellij Idea error while importing projet from Android studio - java

I am getting following error while importing project from Android Studio to Intellij Idea Professional Edition. I tried adding JAXB by importing externally but didn't work.
Unable to load class 'javax.xml.bind.JAXBException'. Possible causes
for this unexpected error include: Gradle's dependency cache may be
corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping
all Gradle daemons may solve this problem. Stop Gradle build processes
(requires restart)
Your project may be using a third-party plugin which is not compatible
with the other plugins in the project or the version of Gradle
requested by the project.
In the case of corrupt Gradle processes, you can also try closing the
IDE and then killing all Java processes.
my gradle-wrapper.properties :
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

The error means that in Java 12 JAXB has been removed or not compatible, I have solved the exact problem by reverting back my jdk from jdk 12 to jdk 8. Hope it helps.

Related

gradle7.3.3 Could not determine java version from '11.0.10'

I am trying be build a java application using "gradlew build". I have installed gradle 7.3.3
and I have java 11.0.10.
From other answers I understand that gradle is compatible with older version but here I have java 11 and latest gradle still I am getting this error.
I also tried following gradle wrapper --gradle-version 7.3.3 but it is giving me following error:
Can anyone suggest what I am missing or should differently.
EDIT: (Content of gradle.wrapper.propertiese file)
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://server_path/gradle/4.6/gradle-4.6-bin.zip
Thanks
After doing some research I found the resolution, posting so that it might help someone else.
NOTE: the gradle you installed on your machine and the gradle used by the project you are trying to build might be different. If you are in bad luck then they might be incompatible based on java version you have on your system.
I had gradle 7.3.3 on my system and the project was using gradle 4.6. The gradle used by project is not compatible with java 11. So, to be on safe side I downgraded both Gradle (to v 4.6) and java (to 1.8) and it worked.
You might not required to downgrade the gradle version on your local machine. I will try that as well and update this answer.
EDIT: It worked with Gradle 7.3.3, java 1.8 and the project using Gradle 4.6.

I try to add Volley library but every time show me this error

Unable to find method
org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal.getPublishableFiles()Lorg/gradle/api/file/FileCollection;'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin that is not compatible with the other plugins in the project or the version of the Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

Could not resolve all files for configuration ':app:androidApis'

CONFIGURE SUCCESSFUL in 1s
Calling mockable JAR artifact transform to create file: C:\Users...gradle\caches\transforms-1\files-1.1\android.jar\637e2bccbff6bd0f7a7583f7e9d4551b\android.jar with input C:\Users...\AppData\Local\Android\Sdk\platforms\android-28\android.jar
Gradle sync failed: Could not resolve all files for configuration ':app:androidApis'.
Failed to transform file 'android.jar' to match attributes {artifactType=android-mockable-jar, returnDefaultValues=false} using transform MockableJarTransform
Cannot create mockable android.jar
zip file is empty
I am new to android studio. I have tried all the answers I could get none worked.
I changed my gradle plugin to 3.1.1 and lower is still the same thing.
I have clean build and invalidate cache/reset.
Do I have to install a lower android studio. Why is this happening for a new project?
Andriod studio 3.2.1
#Openwell thanks a lot. you save my day!
I found the source of the problem. I noticed that the andriod.jar file in C:\Users**\AppData\Local\Android\Sdk\platforms\android-28 was missing, the file was 0kb. which shouldn't be so. So I reinstalled the Android SDK platform and sources by uninstalling it from SDK Manager and installed it back. then the problem was solved.
I just changed the compiled version to API level to which I have downloaded in the SDK Manager. For me in File=>Project Structure, the compiled version is set to 29 which I haven't downloaded SDK. So I changed it to 28 which I have downloaded.Then it worked.
After upgrading AndroidStudio version to 4.1, also upgraded Android Gradle plugin to 4.1.0.
But in Project root folder build.gradle file, In dependencies, it has this below gradle classpath for com.google.gms:google-services version as 4.3.0. Caused the issue.
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.google.gms:google-services:4.3.0'
}
after upgrading com.google.gms:google-services to latest version, and Sync project.
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.google.gms:google-services:4.3.4'
}
Solved the issue.

ClassNotFoundException: org.gradle.logging.StyledTextOutput$Style

I'm trying to build my android app using Android Studio and I keep getting the Gradle Sync error
Error: Unable to load class 'org.gradle.logging.StyledTextOutput$Style'.
Possible causes for this unexpected error include:Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
Over the course of the past few hours I've restarted gradle, uninstalled it, installed multiple different versions but I cannot seem to get the project to build for the life of me.
Some of my research has said that gradle 3.0.0 has fixed this problem but, I'm currently building using gradle 3.3.
Research sources:
https://github.com/KeepSafe/dexcount-gradle-plugin/issues/123
https://github.com/KeepSafe/dexcount-gradle-plugin/issues/124

Build Error in Android Studio 2.1.3

I am using android studio 2.1.3. I am getting the following error, in spite of clearing the project and rebuilding it again, restarting etc... How to solve it?
Error:Execution failed for task :app:transformClassesWithJavaResourcesVerifierForDebug.
org.gradle.api.internal.changedetection.rules.DescriptiveChange cannot be cast to org.gradle.api.tasks.incremental.InputFileDetails
ay be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
Thanks.
I am using Windows 8.1
I tried deleting the folder .gradle in the application folder. Then I cleaned the project and build it again. IT WORKS FINE NOW.
Have you cleaned your project through terminal ?
If not use ./gradlew clean this from root project.
Also check your gradle files, Is everything is up-to-date and correctly written there. Check for dependencies also.

Categories

Resources