Tried to implement Dokka in code but keep running into Gradle sync failed: Could not find method classpath() for arguments [org.jetbrains.dokka:dokka-gradle-plugin:0.9.16-eap-2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I've tried to look at other people's solution but it doesn't seem to work.
https://github.com/Kotlin/dokka/issues/258
This issue from github lead me to stack
Dokka - skip generating javadoc for default android packages
Which also does not work
I've tried to change
ext.dokka_version = '0.9.17'
ext.dokka_version = '0.9.16-eap-2'
Also adding
repositories {
maven { url "https://dl.bintray.com/kotlin/kotlin-eap/" }
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'org.jetbrains.dokka-android'
...
dokka{
outputFormat = 'javadoc'
outputDirectory = "$buildDir/javadoc"
skipEmptyPackages = true
noStdlibLink = true
}
...
dependencies{
classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}"
}
buildscript{
ext.kotlin_version = '1.3.21'
ext.dokka_version = '0.9.16-eap-2'
repositories{
google()
jcenter()
maven { url "https://dl.bintray.com/kotlin/kotlin-eap/" }
}
dependencies{enter code here
classpath 'com.android.tools.build:gradle:3.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:$dokka_version"
}
I've tried changing and adding different ext.dokka_version but nothing seems to work. I just expect it to run to generate some KDOC.
Adding it to the buildscript dependencies instead of outside dependencies for classpath lead it goes to the right classpath
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}"
}
}
repositories {
jcenter() // or maven { url 'https://dl.bintray.com/kotlin/dokka' }
}
apply plugin: 'org.jetbrains.dokka'
Related
I want to add lottie dependency in my project.
this is the way that lottie document recommends
implementation "com.airbnb.android:lottie-compose:$lottieVersion"
allprojects {
repositories {
...
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}}
here is my gradle
buildscript {
ext {
compose_version = '1.1.1'
lottie_version = '0.5.4-SNAPSHOT'
}}
plugins {
id 'com.android.application' version '7.1.1' apply false
id 'com.android.library' version '7.1.1' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false}
task clean(type: Delete) {
delete rootProject.buildDir}
as you can see there is no allProjects in my gradle.
how can I add Maven repository?
Go to your build.gradle module and inside dependencies section add
implementation "com.airbnb.android:lottie-compose:$lottieVersion"
Now go in settings.gradle and inside dependencyResolutionManagement -> repositories add this
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
My project is an old android application (module-front) with modules (module-shared) that used to be published on maven.
I have an access to source code of the module and I want to store my module in my mavenLocal.
My directory structure :
/project
/module-front
build.gradle
/module-shared
build.gradle
build.gradle
My module-front gradle file has a dependency on the published (but removed) module-shared :
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
// Android properties here
}
dependencies {
ext {/* Versions here */}
compile group: 'module-shared group', name: 'module-shared name', version: moduleSharedVersion
// compile and testCompile here
}
repositories {
mavenLocal()
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
apt {
// apt here
}
ModuleSharedVersion is defined in my root gradle file :
buildscript {
repositories {
mavenLocal()
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
allprojects {
ext {
moduleSharedVersion= '2.1'
}
version = '1.4.8h'
group = 'myGroup'
}
Problem starts here:
Now I want my module-shared to be stored in mavenLocal so my module-front might access it :
apply plugin: 'application'
apply plugin: 'maven'
version = '2.1'
uploadArchives {
repositories {
mavenInstaller {
repository(url: mavenLocal().url)
pom.groupId = 'module-shared group'
pom.artifactId = 'module-shared name'
pom.version = version
}
}
}
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
This is my attempt to store it in mavenLocal inspired from multiple posts (example) which doesn't work...
I don't know much about gradle, not enough to fix it tbh.
Please tell me if you need any other file that might be important to understand/answer.
Thanks :)
In the section adding the gradle plugin for this React Native component, it tells me to add the following code to app/build.gradle:
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
However, I've added other components that said to add similar code. For example, this component says to add this code:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
What I Want To Know:
How do you add the code for both of these components into the same project?
You should have one build script and add all the repositories in the repositories block and the dependences in the dependencies block
it should be like this
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
for the apply plugins should be in the build.gradle for the app module
add them on the top
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
defaultConfig {
applicationId "your.app.package"
}
}
While integrating WorkManager in my Application, I updated my app settings as follows:
androidMinSdkVersion = 15
androidTargetSdkVersion = 28
androidCompileSdkVersion = 28
androidBuildToolsVersion = "28.0.0"
Due to version upgrade to 28 I had to update gradle too.
gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
Project.gradle
buildscript {
repositories {
// Gradle 4.1 and higher include support for Google's Maven repo using
// the google() method. And you need to include this repo to download
// Android Gradle plugin 3.0.0 or higher.
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url "http://dl.bintray.com/populov/maven" }
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
mavenCentral()
jcenter()
gradlePluginPortal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Due to all these changes(mainly WorkManger), I had to (was forced to) upgrade the butterknife library version to 9.0.0 at least.
So I updated it as follows in my app.gradle file
apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.butterknife'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.3'
classpath 'com.jakewharton:butterknife-gradle-plugin:10.1.0'
}
}
But whenever I try to clean-build I keep getting following error in logcat.
ERROR: Could not find com.android.tools.build:gradle:3.1.4.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.jar
Required by:
project :_btn_payment > com.jakewharton:butterknife-gradle-plugin:10.1.0
Any help is appreciated.
You should move your classpath 'com.jakewharton:butterknife-gradle-plugin:10.1.0' to Project.gradle
butterknife 10.x only supports AndroidX-enabled builds.
You will changed to version 9.0.0
From gradle gradle plugin 3.0 apt has deprecated,delete classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
library build.gradle
apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.butterknife'
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.2.3'
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0'
}
}
I am using gradle and I am trying to add kotlin to my project. But when I am trying to add 'kotlin-android-extensions' plugin for gradle it fails to find it.
To use the plugin, you have to add it in your root level file:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
ext.kotlin_version = '1.1.2-4'
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Try to add the following to your gradle.build file
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
after that you have to make some changes in your dependencies classpath like this.
buildscript {
ext.kotlin_version = '1.1.60'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
and in dependencies compile make sure to add jre7 such that.
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
After doing all that rebuild the gradle and you are all done. This worked for me because i was facing the same problem you are now, and after this it's all done. Hope it works for you tooo....
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:+"
try this