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

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

Related

Check your module classpath for missing or conflicting dependencies KMM

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

Why is my react navigation not working on android?

Recently I merged some changes from a colleague and these changes have React Native Navigation setup in it. After installing all the dependencies and setting up everything, When I run the app, I get this error that says
com.app.MainActivity cannot be cast to com.reactnativenavigation.NavigationActivity
Apparently, the error is coming from the following file
react-native-navigation\lib\android\app\src\main\java\com\reactnativenavigation\react\NavigationModule.java
How to reproduce
I am not really sure how to reproduce this error because I don't know what's causing it in the first place. However, the only other unexpected behavior was that my Android Studio or react-native run-android both were failing gradle build when I first added all the required dependencies. The reason for failure was kotlin-android and even though I can confirm that from the build.gradle files of the repository that the required settings exist, still I had to add the relevant required config to my main applications android/gradle.build and android/app/gradle.build
Apparently this solved the issue with now react-native run-android running successful gradle build.
The repository has the following dependencies config
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
Despite the presence of above, my gradle builds were failing and complaining about android-kotlin so I added the following dependencies config to my app's android/gradle.build
classpath('com.android.tools.build:gradle:3.6.2')
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
Notice the difference in versions of the gradle (This gradle version came by default with RN 0.62) and kotlin-gradle-plugin. I don't know, but could this be the cause of the issue?
I am using latest version 5.5.1 for #react-navigation/native
I finally figured this out. Actually the problem was being caused by another package that was just added to the project and wasn't setup and being used. The package that was causing the issue was https://github.com/wix/react-native-navigation which I didn't notice it was there and it apparently wasn't properly configured.

please explain me. 'Plugin with id not found', 'Android NDK undefined modules'

I downloaded 'Tess-two' library.
After project was ndk-builded&ant release in cmd, I import library in my project.
here was one error.
'Plugin with id 'com.github.dcendents.android-maven' not found.'
I had solved, just add 2 line in my app module gradle.
-like this
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
The error was completely solved, however another error appeared.
C:/android-ndk-r14/build//../build/core/build-binary.mk:687: Android NDK: Module
pngt depends on undefined modules: z
C:/android-ndk-r14/build//../build/core/build-binary.mk:700: *** Android NDK: Ab
orting (set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies).Stop.
At this time, I just added one line in tess-two\jni\Application.mk.
APP_ALLOW_MISSING_DEPS=true
Now, my project can build very well.
But I can't understand what I did.
Somebody please explain to me. What mean that error and how that codes could solve that error.
Module builds will now fail if they have any missing dependencies.
https://github.com/android-ndk/ndk/wiki/Changelog-r14-beta1
File > Project Structure
As I wrote above, since it is the specification of NDK r14, we could do it after downloading NDK r13b.
It will be r14 in the near future, but you can also download old revisions, so please check them yourself.

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.

Project builds fine from command line, fails within Android Studio

I have a project that started in Eclipse over a year ago and I'm trying to import and use it within Android Studio. I've exported build.gradle from Eclipse and imported it into Android Studio. The project uses the support library, and while this didn't make it into build.gradle, I have added this line manually:
compile 'com.android.support:appcompat-v7:+'
If I run the build from the command line (./gradlew assembleDebug) it succeeds. Building from within Android Studio fails with errors that sound like it's not picking up the support library:
Error:(3, -1) android-apt-compiler: [module] /Volumes/User/Steve/src/.../android/res/menu/foo_menu.xml:3: error: No resource identifier found for attribute 'showAsAction' in package 'com.company.app'
I just updated Android Studio to the 0.5.9 release this morning. I believe I'm using a recent Gradle. There's this part in my build.gradle in the buildscript section:
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
And then this in gradle/wrapper/gradle-wrapper.properties:
distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-all.zip
So my question is: why do I get different behavior from within the IDE than from the command line? How can I further troubleshoot what is going wrong from within Android Studio so that it runs the build exactly the same?

Categories

Resources