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 :)
Related
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'
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 use AIDE while on the go. On Android Studio I added Crashlytics to my project but upon moving it over to AIDE,it doesn't seem to recognize Crashlytics. Specifically, this line is specified as an unknown dependant according to compile error:
compile('com.crashlytics.sdk.android:crashlytics:2.5.2#aar') {
transitive = true}
Is there anything I can do to fix this or is AIDE incapable of supporting Crashlytics?
Ensure you have the plugin preinstalled in Android Studio - https://fabric.io/downloads
Then in your build.gradle, add/update the following at the very top:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// Fabric
classpath 'io.fabric.tools:gradle:+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
If AIDE does not work properly, then please download the AAR library, then copy it in your /libs folder (say the name of the file is fabric-2.5.2.aar
Update build.gradle as follow:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// Fabric
classpath 'io.fabric.tools:gradle:+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
// .aar repositories
repositories {
flatDir { dirs 'libs' }
}
dependencies {
compile(name: 'fabric-2.5.2', ext: 'aar')
...
}
I'm trying to add Appdynamics into my application, I'm doing those steps: https://docs.appdynamics.com/display/PRO40/Instrument+an+Android+Application#InstrumentanAndroidApplication-ToaddtheAppDynamicsAndroidagentrepositorytoyourproject but after all I have error:
Error:(15, 13) Failed to resolve: com.appdynamics:appdynamics-runtime:1.0
This is how my build.gradle (for all project) looks like:
buildscript {
configurations.classpath.resolutionStrategy.force('com.android.tools.build:gradle:1.2.3')
repositories {
maven { url uri("adeum-maven-repo") }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3', 'com.appdynamics:appdynamics-gradle-plugin:2.0'
}
}
allprojects {
repositories {
mavenCentral()
}
}
and build.gradle (from app module):
apply plugin: 'adeum'
repositories {
flatDir {
dirs 'lib'
}
maven {
url uri('adeum-maven-repo')
}
}
dependencies {
compile 'com.appdynamics:appdynamics-runtime:1.0'
and adeum-maven-repo paste into project. Any idea what am I doing wrong?
That error means that gradle is unable to resolve the dependency on com.appdynamics:appdynamics-runtime. The easiest way to fix this problem is to use the AppDynamics libraries from maven central rather than the adeum-maven-repo directory. You can do that by editing your top level gradle file to look like this:
buildscript {
configurations.classpath.resolutionStrategy.force('com.android.tools.build:gradle:1.2.3')
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.appdynamics:appdynamics-gradle-plugin:4.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
Then your project-level gradle file would look like:
apply plugin: 'adeum'
repositories {
flatDir {
dirs 'lib'
}
}
dependencies {
compile 'com.appdynamics:appdynamics-runtime:4.+'
}
Note that I have removed the references to adeum-maven-repo, and changed the version numbers on the AppDynamics artifacts to refer to them as they exist in maven central. Once you've done this, you no longer need adeum-maven-repo in your project, since gradle is now downloading these dependencies automatically.
Folks,
I am trying to use
com.github.ksoichiro:android-observablescrollview:1.5.1
and I had several problems which prompted me to add:
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
to my Project's build.gradle file, now when I try to sync my project I get the following message:
Error:Cause: java.io.FileNotFoundException: D:\Backup 2015\Development\AndroidStudioProjects\IKAG\src\main\AndroidManifest.xml (The system cannot find the path specified)
This is my whole build.gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
apply plugin: 'com.android.application'
//
repositories {
mavenCentral()
}
android {
compileSdkVersion 20
buildToolsVersion '21.1.2'
}
dependencies {
// Other dependencies are omitted
compile 'com.github.ksoichiro:android-observablescrollview:1.5.1'
}
allprojects {
repositories {
jcenter()
}
}