Android Studio 3 canary & Kotlin - android

Has anyone got the message "Kotlin not Configured"
I'm sure I missed something, but for the most part I downloaded it, and just had it import my existing 2.x settings. I tried a simply copy/paste from a java class to a new Kotlin file, and that's where I'm at.
Here is my current top level build.gradle
buildscript {
repositories {
jcenter {
url = "http://jcenter.bintray.com/"
}
maven {
url = "https://maven.google.com"
}
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
}
}
allprojects {
repositories {
jcenter {
url = "http://jcenter.bintray.com/"
}
maven {
url = "https://maven.google.com"
}
mavenCentral()
}
}
And then at the top of my module build file I have these two lines
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
The current error is "Plugin with id 'kotlin-android' not found"

You're missing a Kotlin dependency in the dependencies block:
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

That message has appeared in previous versions of Android Studio (before v.3.0) when Kotlin library was not among class paths in the gradle script.
Probably, when importing your project that had no Kotlin, you've got overlapping with previous settings that results in the fact that Kotlin has not been found.
Try to create a project from scratch, insert your Java code and convert it into Kotlin (Code > Convert Java File to Kotlin File)

Usually the automatic configurator "just works", but take a look at whta it was trying to do: http://kotlinlang.org/docs/reference/using-gradle.html#targeting-android

I had the same error. I solved it pretty simple: Modify build.gradle to force a gradle sync.

Simple.
Just go to Tools -> Kotlin -> Configure kotlin in project.
In the window that appears, click on Android with gradle.
Let the project sync and you are good to go.

Related

Unable to load class 'org.gradle.api.publication.maven.internal.MavenPomMetaInfoProvider'

When I update gradle in android studio
I found this type error
Unable to load class 'org.gradle.api.publication.maven.internal.MavenPomMetaInfoProvider'.
his is an unexpected error. Please file a bug containing the idea.log file.
In my case, the issue was in this line:
apply plugin: 'com.github.dcendents.android-maven'
Before now, I was using Gradle plugin 4.2.2, and today I updated it to 7.0.0 and got the same error as you. I solved the issue by removing this line from my build.gradle.
I experienced this issue when using a library pushed on jitpack.io
The docs on jitpack.io mention to include this in the root build.gradle file
allprojects {
repositories {
....
maven { url 'https://jitpack.io' }
}
}
Where as with the latest updates this has changed. Android Studio no longer includes a allprojects block in the root build.gradle file.
To make this work you now need to include maven { url 'https://jitpack.io' } in settings.gradle file instead.
Here is how my settings.gradle looks like:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
rootProject.name = "<App Name>"
include ':app'
DATE UPDATED EVERY TIME I GOT UPVOTE AS I KNOW IT IS STILL VALID
DATE: 04/11/2021 (4th of Nov 2021)
after receiving that error when updated to gradle 7.0.0, I tried #Alex solution but, it didn't work for me,
I removed two lines and it's working now.
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'android-maven'
Check if other modules have this plugin:
apply plugin: 'com.github.dcendents.android-maven'
In my case it was in countrycodepicker
I removed it from there, and it worked.
Downgrade your gradle version to 6.7.1. It works for me.

Failed to apply 'io.fabric' plugin on Android

I'm trying to add Firebase Crashlytics.
Firebase Crashlytics tutorial is very simple:
https://firebase.google.com/docs/crashlytics/get-started?authuser=0
I've already added repositories (in buildscript and in all projects), as well as classpath and implementation of dependency. All just like in the tutorial. But when I applying 'io.fabric' plugin (apply plugin: 'io.fabric') and pressing 'Sync' in Android Studio - next error is shown:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'io.fabric']
> No such property: verboseGradlePlugin for class: java.lang.String
I'm applying plugin after "apply plugin: 'com.android.application'".
Tried to add Fabric plugin to Android Studio - didn't help.
Tried all plugin versions down to 1.24.0. (Current is 1.25.4)
Invalidated caches and restarted Android Studio.
Tried to add 'fabric.properties' file to app folder as well as 'crashlytics.properties' file.
Tried to pass -DverboseGradlePlugin=false or with 'true' to gradle's 'build' task.
Gradle knows about 'io.fabric' plugin, but trying to find 'verboseGradlePlugin' property that is missing. I haven't found any info about such issue in the google.
Maybe someone already faced the same problem or have any suggestions how to solve this?
UPD:
My project-level build.gradle
My app-level build.gradle
Gradle version - 4.4
Android gradle plugin version - 3.1.2
Step1:
In your project level build.gradle add:
maven {
url 'https://maven.fabric.io/public'
}
NB:This addition should strictly be pasted inside your buildscript and not your allprojects gradle script as follows:
buildscript {
repositories {
jcenter()
google()
maven {
url 'https://maven.fabric.io/public'
}
}
Next,add your io.fabric tools into your dependencies in the same gradle(build.gradle)
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.2.1'
classpath 'io.fabric.tools:gradle:1.25.4'
}
As soon as this is done,Sync your gradle before moving onto the next step.You should have something like this for step1
Step2:In your app level build.gradle add
apply plugin: 'io.fabric'
And in your dependencies:
dependencies {
// ...
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
}
Now Sync again and Rebuild and Run your project.
NB:Sync right after manipulating the project level build.gradle before manipulating your app level.
More details here
I had exactly the same problem. The error is generated due to the extra property "crashlytics" in the project-level build.gradle, which generates a conflict.
Simply change the extra property "crashlitycs" to "crashlyticsVersion" or something similar and the error disappears.
I also recommend that you use the suffix "Version" in the extra properties to avoid similar errors.
In your project gradle you should put
buildscript {
repositories {
...
maven {url 'https://maven.fabric.io/public'}
}
...
}
Meanwhile in the app gradle file in the top
apply plugin: 'io.fabric'
and as dependencies
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'

What is the simplest way to mix Java+Scala in an Android project using Gradle?

What is the simplest way to mix Java+Scala in an Android project using Gradle ?
Is it using https://github.com/saturday06/gradle-android-scala-plugin ?
I am asking this because examples in gradle-android-scala-plugin don't work and I don't know how to get started, maybe there is some other easy way to mix Scala+Java ?
Is there any simpler (less painful, buggy) way than the gradle-android-scala-plugin ?
There is no good solution using gradle.
Use sbt-android instead.
Use Android studio 3.3.2 and create Android project.
Write this code in build.gradle file
buildscript {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.github.AllBus:gradle-android-scala-plugin:3.3.2'
}
}
and add app/build.gradle
apply plugin: "com.android.application"
apply plugin: "jp.leafytree.android-scala"
android {
compileSdkVersion 28
...
}
dependencies {
implementation "org.scala-lang:scala-library:2.11.12"
...
}

'Peer Not Authenticated', parse.com SSL certificate expired

I'm currrently struggling with a 'Peer Not Authenticated' issue while gradling on Android Studio. When I try to clean my project, AS tells me that the issue comes from https://maven.parse.com/repo/com/parse/tools/gradle/maven-metadata.xml
With an internet browser, I see that the SSL certificate of *.parse.com has expired on Thursday 26th... I've already tried to replace the 'https' with 'http' in order to bypass the checking but it doesn't work.
Here is the head of my build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.parse'
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.parse.com/repo' }
}
dependencies {
classpath 'com.parse.tools:gradle:1.+'
}
}
I ran into this tonight as well. If you take a look at your IntelliJ log you should see an SSL error associated with reaching that url. To workaround this problem, remove the Parse dependency via the Maven URL and add in the JAR manually to your libs folder.
In your project Gradle add the following under 'dependencies' to reference the manually added libs:
compile files('libs/Parse-1.9.4.jar')
compile files('libs/ParseCrashReporting-1.9.4.jar')
Remove anything that looks like this from both gradle files:
maven {
url 'https://maven.parse.com/repo'
}
classpath 'com.parse.tools:gradle:1.+'
apply plugin: 'com.parse'
parse {
applicationId "blahblahblahblah"
masterKey "ohmasterkeyyousonice"
retries 3
uploadSymbols true
}
Rock and roll hoochie koo...
Note: you just need parse gradle plugin if you are using ParseCrashReporting, if not needed remove it.
Github Issue

Error:Plugin with id 'com.github.dcendents.android-maven' not found

I'm using this library in my Android app. (https://github.com/yazeed44/MultiImagePicker)
Before now, I was adding it to my project this way:
compile 'net.yazeed44.imagepicker:imagepicker:1.3.0'
The problem with importing it that way is, as far as I know, that I can't override any code because I'll lose all the changes after building the project again. (I need to change some code)
For that reason, I have downloaded the source code and I've imported the project as a module with this name: 'imagepicker'
After that, I added this line to my app build.gradle:
compile project(':imagepicker')
and this to my settings.gradle (Android Studio did it)
include ':app', ':imagepicker'
After doing that, I try to run the project and Android studio shows this error:
Gradle 'Project' project refresh failed
Error:Plugin with id 'com.github.dcendents.android-maven' not found.
Since you are using the module locally you have to add in your top-level build.gradle or in the imagepicker/build.gradle same config added in the imagepicker build.gradle project.
buildscript {
repositories {
jcenter()
}
dependencies {
//ADD THESE DEPENDENCIES
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
An alternative can be modify the imagepicker/build.gradle removing the last 2 lines. But you have to test this way.
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
If you check these files you will find the
apply plugin: 'com.github.dcendents.android-maven'
In your case you don't need these files because they are useful only to uplaod in a maven repo the aar file.
I added below code in Project:gradle.build file and its resolved the problem :
allprojects {
repositories {
jcenter()
maven {
url "https://repo.commonsware.com.s3.amazonaws.com"
}
}
}
EDIT
If you still facing after adding above maven dependencies
Change url "https://repo.commonsware.com.s3.amazonaws.com" to url "https://s3.amazonaws.com/repo.commonsware.com".

Categories

Resources