Android - org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: - android

I am building an android application in which I tried to integrate Firebase Performance Monitoring. In the documentation it is mentioned that I need to add the following line in the project level build.gradle
classpath 'com.google.firebase:perf-plugin:1.3.4'
I have misplaced this dependency in app level build.grade by replacing the classpath with implementation. I have realized the mistake I made and then tried to move the dependency to project level build.gradle file but I am getting the following exception.
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
I have even tried removing .gradle folder from the project location and restarted the Android studio but still facing the same issue.
Please help me find the solution.

Related

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.

How do I get rid of this Gradle error?

Could not find com.android.tools.build:gradle:4.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/4.1/gradle-4.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/4.1/gradle-4.1.jar
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle /4.1/gradle-4.1.pom
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/
4.1/gradle-4.1.jar
https://maven.google.com/com/android/tools/build/gradle/4.1/gradle-4.1.pom
https://maven.google.com/com/android/tools/build/gradle/4.1/gradle-4.1.jar
Required by:
project :
Open File
I downloaded the source code of an app and when I try to run I get all kinds of gradle errors. I have been trying to solve it since two days but so far I have been unable to do so. I updated Android Studio to 3.1 but the error is still there. Nothing works.
Here is what I have tried so far:
I deleted all the gradle version in the 'dist' folder and let
Android Studio download everything again.
I have tried to enable
'offline mode' in the Gradle build settings in Android Studio.
I also enabled 'use local gradle distribution'.
P.S: Creating a new project works fine. I just need to run this specific project.
The Gragle version declared is 4.1, but since you are using Android Studio 3.1, the gradle version should be declared as follow into your application build.gradle:
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
...
}
}
You can find the link between the gradle plugin version and the actual gradle version here

error 24 13 android studio faild to resolve

I want add a library to my project in Android Studio, but it gave me this error no matter what my library is. I always get this error when I want to add a library:
Error:(24, 13) Failed to resolve: com.squareup.retrofit2:retrofit:2.1.0
Do I have to sync the project in online mode to add a library? I sync project online work but sync never be ended.
You need to enable online mode so gradle can download the JAR and put it into the gradle dependencies directory. Optionally (which I dont recommend) you can download it manually and put it there.
However once you downloaded a particular dependency you gradle will synch it from the local repo, meaning you dont need internet to add it to another project.

Gradle error in Android Studio: AndroidSdk.SendPing failed, Firebase client lib not compiling

When inserting a new activity (more specifically, navigation drawer activity) my gradle sync breaks and throws the following error:
Failed to find: com.firebase:firebase-client-android:1.1.0.0
I could undo the changes, but I would like to understand why gradle breaks while adding new activities.
Looking over the IDEA LOG, I came by the following Warning:
2014-11-20 15:53:26,547 [ 788010] WARN - ea.stats.LegacySdkStatsService - AndroidSdk.SendPing failed
java.net.UnknownHostException: tools.google.com
I figure it has something to do with the Gradle build file, but I'm not entirely sure why it would compile the Firebase library before adding an activity and after, not.
I'm running on a MacBook Air, OS X Yosemite.
build.gradle: https://gist.github.com/markbratanov/82fe78f7bc2c9064986b
Idea log: https://gist.github.com/markbratanov/d38949010198ec950acd
Any help or suggestions would be appreciated, thanks.
This was solved by deleting the library from gradle dependencies, and searching for the library in Maven Central (in this case, Firebase) and adding the latest version.

Android Studio installation doesn't work with gradle

I am absolute beginner with Android Studio (especially Gradle) and having big trouble getting Android Studio to work. I downloaded and installed the most recent version of Android Studio (0.8.0). I have set the JDK_HOME variable. However, after I create a new project, I always receive the following message:
Error:Unknown host 'jcenter.bintray.com'.
Enable Gradle 'offline mode' and sync project.
Learn about configuring HTTP proxies in Gradle
If I try to compile the project, I get the following message dialog:
After reading a post, I manually downloaded the Gradle binaries (latest, 2.0), extracted it onto the local drive, went to Settings and set the Gradle path to the respective directory using the following:
I also tweaked the build.gradle file under the project to point to the latest Gradle 2.0 version. However, now I get the following error message:
Error:A problem occurred configuring root project 'HelloAndroidStudio'.
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:2.0.+.
Required by:
:HelloAndroidStudio:unspecified
Failed to list versions for com.android.tools.build:gradle.
Unable to load Maven meta-data from http://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml.
Could not GET 'http://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml'.
jcenter.bintray.com
Please can someone help. Being my first time with Gradle, I have been trying for so many days without any clue to the problem. Thanks.
Change the Gradle version to lower ones and restart the Android Studio, you may get it.
Add this in build.gradle
classpath 'com.android.tools.build:gradle:1.1.0'
Setting the http_proxy under appearance & behaviour -> system settings -> http proxy has solved the problem
Change to the latest classpath in the dependencies.
For AS 1.5.1 I will do like this :
buildscript {
repositories {
jcenter()
}
dependencies {
**classpath 'com.android.tools.build:gradle:1.5.0'**
}
}

Categories

Resources