I have been trying to use ok.io, (version 1.14.1), locally in my project and it's been quite a struggle getting through the gradle requirements. My project requires that I include the source locally. I have managed to import the module but when attempting to run a build I end up with this error
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve project :okio.
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve project :okio.
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve project :okio.
Unable to resolve dependency for ':app#release/compileClasspath': Could not resolve project :okio.
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve project :okio.
I had thought this solution would be the way to go as it says all modules need to have the same build types and flavours. But this has not made a difference.
My (app) build.gradle looks like this
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.some.app.id"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {}
}
productFlavors {
}
compileOptions {
targetCompatibility 1.7
sourceCompatibility 1.7
}
}
dependencies {
.....
implementation project(path: ':okio')
}
The ok.io build.gradle looks like this
import com.github.jengelman.gradle.plugins.shadow.transformers.DontIncludeResourceTransformer
import com.github.jengelman.gradle.plugins.shadow.transformers.IncludeResourceTransformer
apply plugin: 'java-library'
apply plugin: 'org.jetbrains.kotlin.platform.jvm'
apply plugin: 'ru.vyarus.animalsniffer'
apply plugin: 'me.champeau.gradle.japicmp'
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: 'me.champeau.gradle.jmh'
apply from: "$rootDir/gradle/gradle-mvn-push.gradle"
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
jar {
manifest {
attributes('Automatic-Module-Name': 'okio')
}
}
animalsniffer {
sourceSets = [sourceSets.main]
}
configurations {
baseline
}
jmhJar {
def excludeAllBenchmarkLists = new DontIncludeResourceTransformer()
excludeAllBenchmarkLists.resource = "META-INF/BenchmarkList"
transform(excludeAllBenchmarkLists)
def includeCorrectBenchmarkList = new IncludeResourceTransformer()
includeCorrectBenchmarkList.resource = "META-INF/BenchmarkList"
includeCorrectBenchmarkList.file = new File("$rootDir/okio/jvm/build/classes/java/jmh/META-INF/BenchmarkList")
transform(includeCorrectBenchmarkList)
}
jmh {
// The JMH plugin currently requires the Shadow plugin also be installed.
// See: https://github.com/melix/jmh-gradle-plugin/issues/97#issuecomment-374866151
include = ['com\\.squareup\\.okio\\.benchmarks\\.SelectBenchmark.*']
duplicateClassesStrategy = 'warn'
}
dependencies {
signature 'org.codehaus.mojo.signature:java16:1.1#signature'
expectedBy project(':okio')
implementation deps.kotlin.stdLib.jdk6
compileOnly deps.animalSniffer.annotations
compileOnly deps.jsr305
testImplementation deps.test.junit
testImplementation deps.test.assertj
testImplementation deps.kotlin.test.jdk
baseline('com.squareup.okio:okio:1.14.1') {
transitive = false
force = true
}
jmh deps.jmh.core
jmh deps.jmh.generator
}
task japicmp(type: me.champeau.gradle.japicmp.JapicmpTask, dependsOn: 'jar') {
oldClasspath = configurations.baseline
newClasspath = files(jar.archivePath)
onlyBinaryIncompatibleModified = true
failOnModification = true
txtOutputFile = file("$buildDir/reports/japi.txt")
ignoreMissingClasses = true
includeSynthetic = true
classExcludes = [
'okio.SegmentedByteString', // internal
'okio.Util', // internal
]
methodExcludes = [
'okio.ByteString#getByte(int)', // became 'final' in 1.15.0
'okio.ByteString#size()', // became 'final' in 1.15.0
]
}
check.dependsOn(japicmp)
assemble.dependsOn(tasks['jmhJar'])
The module's structure in my project looks like this
Any advice on how to integrate ok.io locally and/or just "happy" module integration is greatly appreciated.
Related
i'm trying to import this android-gif-drawable to my project, but even if i did set the emplementation and settings, i can't import or use it.
Here my build.graddle(:app)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.androidapp"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.25'
implementation 'com.squareup.picasso:picasso:2.8'
}
And my settings.gradle(AndroidApp)
import org.gradle.api.initialization.resolve.RepositoriesMode
pluginManagement {
repositories {
gradlePluginPortal()
google()
//jcenter()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
//jcenter()
mavenCentral()
//maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
// maven { url 'https://jitpack.io' }
}
}
rootProject.name = "AndroidApp"
include ':app'
But everytime i try to import it or use it i got errors:
import pl.droidsonroids.gif.GifImageView; -> Unresolved reference: pl
<pl.droidsonroids.gif.GifImageView -> Cannot resolve class pl.droidsonroids.gif.GifImageView
I tried to set as specified on the coral page with the "buildscript" before the "plugins" and "allproject" after, but of course i have the error:
Build was configured to prefer settings repositories over project repositories but repository 'MavenRepo' was added by build file 'app\build.gradle'
I can't find a way to make it work or at least see if the library is correctly loaded (but since i don't have an error for the dependency as some other posts, i imagine it found it).
Hum...ok so its's working now...
while it wasn't working i restarted android studio, closed the app, clean and rebuilded the project many time, and it was still not working.
I sleeped, restarted to work ( android wasn't closed) and it worked.. I suposed it was stil loading yesterday when i tried? honnestly i dont get it.
hope this will help someone in the same situation
after migrating to Android studio 3 I'm unable to compile as I' have folowing errors:
Error:Could not find the AndroidManifest.xml file, using generation
folder
[/home/salacr/git/Evotech/app/build/generated/source/apt/debug])
Error:Parceler: Code generation did not complete successfully. For
more details add the compiler argument -AparcelerStacktrace
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
It might be connected with usage of android anotation my app/build.gradle looks like this:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
def AAVersion = '4.3.1'
def parcelerVersion = '1.1.9'
android {
compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
applicationId "com.my.app"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
}
signingConfigs {
release {
storeFile file("******")
storePassword "******"
keyAlias "******"
keyPassword "******"
}
}
buildTypes {
release {
minifyEnabled false
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
splits {
abi {
enable true // enable ABI split feature to create one APK per ABI
universalApk true //generate an additional APK that targets all the ABIs
}
}
/*
// map for the version code
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'mips':5, 'mips64':6, 'x86':8, 'x86_64':9]
android.applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) * 1000000 + android.defaultConfig.versionCode
}
}
*/
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation "org.parceler:parceler-api:$parcelerVersion"
annotationProcessor "org.parceler:parceler:$parcelerVersion"
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
implementation "org.androidannotations:androidannotations-api:$AAVersion"
implementation 'com.android.support:appcompat-v7:26.0.1'
implementation 'com.android.support:multidex:1.0.2'
}
I'm unable to find the root cause for this, any suggestions?
I tried diferent graddle versions as well as using different buildToolsVersion tools, but without effect.
Any suggestions?
Thanks!
EDIT 1: I have found out that problem is here:
splits {
abi {
enable true // enable ABI split feature to create one APK per ABI
universalApk true //generate an additional APK that targets all the ABIs
}
}
Without this everything works as expected. IT seams that this config isn't compatible with androidanotations in new Android studio
EDIT 2: There is already issue in androidanotation: https://github.com/androidannotations/androidannotations/issues/2034
I had similar issue and solved my problem when I updated android annotation version from 4.4.0 to 4.5.0.
Add the following code in build.gradle file under defaultConfig
javaCompileOptions {
annotationProcessorOptions {
arguments = [
"androidManifestFile":"$projectDir/src/main/AndroidManifest.xml".toString()
]
}
}
I solved this problem changed graddle version:
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
I had similar issue and solved my problem when I updated android annotation version from 4.4.0 to 4.6.0.
I am getting this error in the gradle file:
Error: Failed to resolve: com.google.android.gms:play-services-measurement:10.2.4
-Install Repository and sync project
-Open File
-Show in Project Structure dialog
But I don't use the play-services-measurement in my app.
In the other hand, if I click on the link "Install Repository and sync project" nothing happens.
Any could help me with this? I have been wasting days with this issue.
This is my full gradle file:
apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
}
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileOptions {
encoding "UTF-8"
}
lintOptions {
disable 'MissingTranslation'
abortOnError false
}
defaultConfig {
applicationId "xxx.yyy.zzz"
minSdkVersion 9
targetSdkVersion 25
versionCode 120
versionName "1.20"
multiDexEnabled true
//Enabling multi dex support due to exceeding the 65K methods dex limit imposed by Android: http://stackoverflow.com/questions/29756188/java-finished-with-non-zero-exit-value-2-android-gradle
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationVariants.all { variant ->
variant.outputs.each { output ->
def formattedDate = new Date().format('yyyyMMddHHmmss')
def newName = output.outputFile.name
newName = newName.replace("app-", "MyAppName")
newName = newName.replace("-release", "-release" + formattedDate)
//noinspection GroovyAssignabilityCheck
output.outputFile = new File(output.outputFile.parent, newName)
}
}
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':simple-crop-image-lib')
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-messaging:10.2.4'
compile 'com.google.android.gms:play-services:10.2.4' //8.3.0' 10.2.4' 9.0.0' 9.6.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:mediarouter-v7:25.3.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
//For soap:
compile files('libs/ksoap2-android-assembly-2.5.8-jar-with-dependencies.jar')
}
apply plugin: 'com.google.gms.google-services'
Update Google Repository in Android SDK. Works for me with version 47.
From the firebase doc:
dependencies {
// ...
compile 'com.google.firebase:firebase-core:10.2.4'
compile 'com.google.firebase:firebase-messaging:10.2.4'
// Getting a "Could not find" error? Make sure you have
// the latest Google Repository in the Android SDK manager
}
For me worked to remove these lines from the "app build.gradle":
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
}
}
And add these to the "project build.gradle":
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
I'm new in Android Studio and i want to add dependency to custom view (https://github.com/glomadrian/dashed-circular-progress) in my project. I downloaded *.arr file from Maven repository and imported it like a AAR module. But i can't compile my project because there are some exceptions with this custom view: ClassNotFoundException. Could someone explain me step by step how to correctly add dependencies from maven rep? or there are some problems with this DashedCircularProgress.aar? Thanks.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.ahryk94gmail.mibandsdk"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url "http://dl.bintray.com/glomadrian/maven"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile files('libs/gson-2.6.2.jar')
compile 'com.github.glomadrian:DashedCircularProgress:1.0#aar'
}
As mentioned in the project description you have to add the following code to build.gradle:
repositories {
maven {
url "http://dl.bintray.com/glomadrian/maven"
}
}
dependencies {
compile 'com.github.glomadrian:DashedCircularProgress:1.0#aar'
}
UPDATE:
Also you can use jitpack.io and download the dependency right from GitHub.
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
compile 'com.github.glomadrian:dashed-circular-progress:59d245a'
}
Since updating to AS 0.5.1, I have been unable to sync up my project. Gradle gives me the following warning:
No signature of method: static com.google.common.collect.ArrayListMultimap.create() is applicable for argument types: () values: []
Possible solutions: clear(), grep(), get(java.lang.Object), get(java.lang.Object), getAt(java.lang.String), isCase(java.lang.Object)
It does not point to anything in my build.gradle file that may be causing the issue, so I am rather lost as to where to begin.
Edit: When attempting to run gradle build, I subsequently get this issue when applying the Android plugin:
A problem occurred evaluating root project 'tve-android'.
> Could not create plugin of type 'AppPlugin'.
My build.gradle file:
buildscript {
repositories {
mavenLocal()
maven {
url "http://nexus.products/nexus/content/groups/public"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android'
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'jacoco'
apply plugin: 'pmd'
android {
compileSdkVersion 19
buildToolsVersion "19.0.2"
defaultConfig.minSdkVersion = 16
defaultConfig.targetSdkVersion = 19
defaultConfig.testInstrumentationRunner = 'android.test.InstrumentationTestRunner'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
main.java.srcDirs = ['src/main/java']
main.resources.srcDirs = ['src/main/resources']
main.res.srcDirs = ['src/res']
main.assets.srcDirs = ['src/assets']
androidTest.java.srcDirs = ['src/test/java']
androidTest.resources.srcDirs = ['src/test/resources']
androidTest.res.srcDirs = ['src/res']
androidTest.assets.srcDirs = ['src/assets']
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
compile 'com.android.support:support-v4:19.0.+'
compile 'commons-io:commons-io:2.+'
compile 'commons-lang:commons-lang:2.+'
compile 'com.loopj.android:android-async-http:1.4.+'
compile 'com.jakewharton:disklrucache:1.0.0'
compile 'net.jpountz.lz4:lz4:1.1.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.1'
androidTestCompile 'com.google.dexmaker:dexmaker:1.+'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.+'
androidTestCompile 'org.mockito:mockito-core:1.9.+'
}
Upgrading gradle to v1.10 is also needed.
I had the same issue and I quickly fix it just by re-import my gradle project.