Check your module classpath for missing or conflicting dependencies KMM - android

I have a project in Android Studio for Kotlin Multiplatform Mobile (KMM) app using Kotlin. I am able to successfully run and build. However, when I open the project in Android Studio, I see the same error in many of the gradle project files .
The error is:
Cannot access 'java.lang.Object' which is a supertype of 'org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet'. Check your module classpath for missing or conflicting dependencies
Error:
build.gradle.kts
When I open the Project Structure are three Suggestions:
Project Structure
However, What is shown first when I open the Project Structure is the Module shared which does not have Source Compatibility neither Target Compatibility.
enter image description here
I have try to change the JavaVersion from VERSION_1_8 to VERSION_11
Android Studio Preferences > Build, Execution, Deployment › Build Tools › Gradle

Related

Android Studio shows every line in build.gradle.kts with red

I have a multi module project with Hilt as dependency injection framework : https://github.com/alirezaeiii/Hilt-MultiModule-Cache
It was building fine with no error message until I updated my Android Studio to Chipmunk 2021.2.1 patch 1 in stable channel.
I can successfully build the project and install it on a device.
Now in all of my build.gradle.kts files, I receive errors, for instance on dependencies part, it shows following error warning :
Cannot access 'java.lang.Comparable' which is a supertype of 'org.gradle.api.Project'. Check your module classpath for missing or conflicting dependencies and
Cannot access 'java.lang.Object' which is a supertype of 'org.gradle.api.Project'. Check your module classpath for missing or conflicting dependencies
If you clone the project, do you get the same errors? The reason I ask this is because maybe something is broken in my Android Studio.
Why is that and how to resolve it?
Addenda
I decided to report it here : https://issuetracker.google.com/issues/234737625

gradle error in unity exported android project

I am going to use the build config property "multiDexEnabled true" to break 64K methods limit following link
https://developer.android.com/studio/build/multidex.html#about
I update to use unity 5.6.1f1 and android studio 2.3.3. I set "build system" option to "Gradle(New)", which is new added from 5.5, then click "Export" to create an android project.
I open the exported project with android studio, then I get the following error
I try the two blue links, but I keep geting this same result.
For my unity project, I only create an empty project and add a button to a unity scene, then export it. I have also tried to build API directly, it works.
It is important for me to export unity project to andoid studio project, because it can help us to use additional compile options
Do any one know what I miss? Or how to export unity project correctly?
Thanks
The gradle error text, if cannot see the image link
Error:org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection
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.
I had the same issue with unity 2017.1.0b4 and Android Studio 2.3.3, gradle 3.3.
You should change android plugin for graddle version in Android studio to 2.3.3
You can specify the Android plugin for Gradle version in either the
File > Project Structure > Project menu in Android Studio, or the
top-level build.gradle file. The plugin version applies to all modules
built in that Android Studio project. The following example sets the
Android plugin for Gradle to version 2.3.3 from the build.gradle file:
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
https://developer.android.com/studio/releases/gradle-plugin.html
Check your local gradle version in directory -
C:\Users\yourname\.gradle\wrapper\dists
Modify your project gradle configuration -
project\gradle\wrapper\gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Make sure gradle-3.3-all match to your gradle version.
If you have wasted a lot of time fixing unity Gradle error but nothing worked then you tried unity internal builder but that gave "Parsing Package error"
then try this, it will not help you make your project using unity's Gradle but it will make your project without any error successfully.
Export your project from unity to a folder eg: ProjectName_Gradle.
open android studio, make sure you are connected to the internet .
close current project then select "Open Gradle, eclipse ADT, etc;" option and open ProjectName_Gradle folder.
check the version of buildTools installed in your android-SDK by opening android-SDK settings from the android studio itself.
edit "build.gradle" file under Gradle Scripts section or under your project.
and change "buildToolsVersion" to the latest version installed in your SDK.
then click "syn project with Gradle Files" from file option and let it sync.
it may ask to update Gradle version, then click update
now there should not be any errors.
now try building APK.

Import a project to Android studio faced problems

I want reading an open source project so I select k9mail for start. The recommendation was run and reading this code in Android Studio. I import k9mail project to AS 1.2.1.1 version. I download gradle 2.4 version and added this in environment variable. When I want to run this application, but I receive some errors that I describe below:
1) When I click Run (Alt+Shift+F10), select Android Application, select my module (there is k9mail) and select USB Device, then I see a warning:
No JDK specified for module 'k-9-master'.
2) When I click on Run (Shift+F10), I faced this error in messages tab:
Gradle DSL method not found: 'android()'
Possible causes:
A)The project 'k-9-master' may be using a version of Gradle that does not contain the method.Open Gradle wrapper file
B)The build file may be missing a Gradle plugin. Apply Gradle plugin
When I updated gradle to 2.4, I changed classpath 'com.android.tools.build:gradle:1.2.3' to 'classpath 'com.android.tools.build:gradle:2.4'' from build.gradle of k9mail, but my problems were not solved.
I googled but I can't find solutions for my problems.
No jdk specified for the module.
For that you have to specify the jdk path through Project Structure.
You may also verify by looking at local.properties
For gradle related issues you just kindly update your gradle build and SDKs to latest versions.
This will minimize your gradle issues.

Could not find com.appdynamics:appdynamics-gradle-plugin:2.0

UPDATED Q : I have tried to run this sample eCommerce app on android studio 1.2.1, build 141.1903![enter image description here][1]..
https://github.com/Appdynamics/ECommerce-Android
and i did what is instructed to run it
but it keeps asking to upgrade gradle to gradle 2.0 or advance.(after i downloaded the new version 2.4).
how to upgrade or integrate gradle in android studio?
what other problems related to it I have to solve?
error I'm getting
Error:
Could not find com.appdynamics:appdynamics-gradle-plugin:2.0.
Searched in the following locations:
file //ANDRO1/gradle/m2repository/com/appdynamics/appdynamics-gradle-plugin/2.0/appdynamics-gradle-plugin-2.0.pom
file://ANDRO1/gradle/m2repository/com/appdynamics/appdynamics-gradle-plugin/2.0/appdynamics-gradle-plugin-2.0.jar
https // repo1.maven.org/maven2/com/appdynamics/appdynamics-gradle-plugin/2.0/appdynamics-gradle-plugin-2.0.pom
https // repo1.maven.org/maven2/com/appdynamics/appdynamics-gradle-plugin/2.0/appdynamics-gradle-plugin-2.0.jar
file /c/ Users/Piyush/.m2/repository/com/appdynamics/appdynamics-gradle-plugin/2.0/appdynamics-gradle-plugin-2.0.pom
file /C /Users/Piyush/.m2/repository/com/appdynamics/appdynamics-gradle-plugin/2.0/appdynamics-gradle-plugin-2.0.jar
Required by:
ECommerce-Android-master:app:unspecified
Just follow this istructions:
Clone a local copy of this project with
git clone https://github.com/Appdynamics/ECommerce-Android
Open Android Studio and Import Project (select app/build.gradle)
Android Studio will ask you to build the project with gradle.
Gradle will use the build.gradle inside the project.
The version of gradle is inside the gradle/wrapper/gradle-wrapper.properties file:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zi
Check for example the file inside the app:
You need put a directory called "adeum-maven-repo" in your project setup .
https://docs.appdynamics.com/display/PRO39/Instrument+an+Android+Application#InstrumentanAndroidApplication-SetupforGradle

How to include RxAndroid in project?

I'm using Android Studio. How can I include RxAndroid in my project as a subproject? I want to build it from the sourcecode.
What I've tried:
-Include it as a git submodule.
-included it in my projects settings.gradle file, "include ':rxandroid', ':app'"
Then I get: Error:Unable to find module with Gradle path ':rxandroid'.
Edit
My folder structure is as follows.
Project
-app
-rxandroid
Edit 2
I changed the folder name from rxandroid to RxAndroid. I also changed the name in the projects settings.gradle, but I still get the same error.
According to http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Multi-project-setup it should simply work by changing settings.gradle to:
include ':app', ':RxAndroid'
And it does work for me. My setup is
Android Studio 0.8.13
RxAndroid cloned from https://github.com/ReactiveX/RxAndroid
My project is using com.android.tools.build:gradle:0.12.+
EDIT:
I should mention that I'm still running Gradle 1.12. I created a new blank project in Android Studio, added RxAndroid to settings.gradle, and a build error appeared:
Error:Cause: startup failed:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/path/spock-core/0.7-groovy-1.8/3a677d19e8d3acf3bd296c4023356256d55da5a3/spock-core-0.7-groovy-1.8.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation because of exception org.spockframework.util.IncompatibleGroovyVersionException: The Spock compiler plugin cannot execute because Spock 0.7.0-groovy-1.8 is not compatible with Groovy 2.3.6. For more information, see http://versioninfo.spockframework.org
Spock location: file:/path/spock-core-0.7-groovy-1.8.jar
Groovy location: file:/path/gradle-2.1/lib/groovy-all-2.3.6.jar
It seems RxAndroid depends on Spock 0.7-groovy-1.8 which won't work with Groovy 2.3.6 of Gradle 2.1. And the latest com.android.tools.build (0.13.x) requires Gradle 2.1.
So I did the following:
in the top level build.gradle (not the app one) change the project's dependency on com.android.tools.build back to 0.12.+
change the Gradle version in gradle-wrapper.properties back to 1.12
Now the project built successfully.

Categories

Resources