I addded jar which require,
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
which require jack to support java8.
According to latest kotlin plugin gives, Error:Kotlin Gradle plugin does not support the deprecated Jack toolchain.
Disable Jack or revert to Kotlin Gradle plugin version 1.1.1.
Currently not able recreate jar with java7. And need use latest version of kotlin which has deprecated Jack toolchain.
I check all possible ways in app.gradle.
Not able to solve this by preview version of studio 3.0 according to this.
project level gradle file,
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.3'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
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
}
}
allprojects {
repositories {
jcenter()
}
}
app level gradle file,
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.root.trial"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile files('libs/bel-1.0.jar')
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
repositories {
mavenCentral()
}
You have not updated gradle plugin in build.gradle(:project).
Replace you project level gradle file with following:
buildscript {
ext.kotlin_version = '1.1.3-2'
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha9'
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
}
}
allprojects {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
}
I hope it helps.
Related
I have tried to use ibm tone analyzer api for my project, but if I include the dependency I get this error:
Duplicate class javax.annotation.CheckForNull found in modules
annotations-3.0.1.jar (com.google.code.findbugs:annotations:3.0.1) and
jsr305-3.0.2.jar (com.google.code.findbugs:jsr305:3.0.2) Duplicate
class javax.annotation.CheckForSigned found in modules
annotations-3.0.1.jar (com.google.code.findbugs:annotations:3.0.1) and
jsr305-3.0.2.jar (com.google.code.findbugs:jsr305:3.0.2)
I have tried to delete testing dependencies, but still won't work, please help
App File:
apply plugin: 'com.android.application'
android {
configurations.all{
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
compileSdkVersion 28
defaultConfig {
applicationId "com.example.loginapp"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
compile 'com.ibm.watson:tone-analyzer:7.0.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'jsr305:3.0.2'
})
implementation 'com.google.firebase:firebase-auth:16.2.1'
}
// Add the following line to the bottom of the file:
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
Gradle Build file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url "https://dl.bintray.com/ibm-cloud-sdks/ibm-cloud-sdk-repo"
}
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
add applicationVariants.all to your gradle.build:
android {
applicationVariants.all { variant ->
variant.getRuntimeConfiguration().exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
}
Actually, it worked but I did not understand and I get an error. How can I fix it?
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.example"
minSdkVersion 18
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.github.:conciseclock:0-SNAPSHOT'
testCompile 'junit:junit:4.12'
}
and
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
allprojects {
repositories {
jcenter()
maven{ url 'https://dl.bintray.com/spark/maven' }
maven { url "https://jitpack.io" }
mavenCentral()
}
}
task customClean(type: Delete) {
delete rootProject.buildDir
}
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
Could not find com.:conciseclock:0-SNAPSHOT.
Required by:
project :app
Error(37,13) Failed to resolve: com.:conciseclock:0-SNAPSHOT
Try with compile 'com.tomduan.conciseclock:library:0.2.2'
Anyway, where did you get this snapshot, because it looks like you are using custom repository manager, not official git.
easy there is no library on this dependences
com.github.zurnacibatuhan:conciseclock:0-SNAPSHOT
or i recommend to check library version so there is no number version as
0-SNAPSHOT
or replace with this line
compile 'com.tomduan.conciseclock:library:0.2.2'
you are using 25.3.1 version in your dependencies.it means you should first add this to your project gradle repositories like this
allprojects {
repositories {
jcenter()
maven{ url 'https://dl.bintray.com/spark/maven' }
maven { url "https://jitpack.io" }
maven {url "https://maven.google.com"}
}
add line
maven {url "https://maven.google.com"}
after that you should replace this line:
compile 'com.github.zurnacibatuhan:conciseclock:0-SNAPSHOT'
with this line:
compile 'com.tomduan.conciseclock:library:0.2.2'
I am very new to Gradle and Android but since I have added Kotlin to my project anytime I get an error in Android Studio I need to go through the Gradle console which does not give me any of the nice stack traces or pathing by default. In the Gradle messages view where errors did appear now I only get
Error:Execution failed for task ':app:kaptDebugKotlin'.
Internal compiler error. See log for more details
Is this the intended functionality because it seems to work ok in the jetbrains example projects.
My Project Gradle file
buildscript {
ext.kotlin_version = '1.1.4-2'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
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
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My App level Gradle file
buildscript {
ext.kotlin_version = '1.1.4-2'
repositories {
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.test.andrew.ccombo_breaker"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/java'
main.java.srcDirs += 'src/main/kotlin'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'com.google.dagger:dagger:2.9'
kapt 'com.google.dagger:dagger-compiler:2.9'
testCompile 'junit:junit:4.12'
}
I did not see any problems,May be you can see here [Gradle Console] ,it print all bulid log.you can see error details,and post error message.
That is old config,May be you can config new like this:
1.remove all about Kotlin config.
2.use the menu->tools-->Kotlin-->Configure Kotlin in project-->Android with Gradle
3.change version to 1.1.2-2, the version 1.1.4-2 for gradle:2.3.3 has something bug
4.Sync gradle
other. The new version use extensions only config this:
apply plugin: 'kotlin-android-extensions'
dont use this:
dependencies {
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
}
ultimate,config like this
Project Gradle file
buildscript {
ext.kotlin_version = '1.1.2-2'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
App level Gradle file
apply plugin: 'kotlin-kapt'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.test.andrew.ccombo_breaker"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
kapt {
generateStubs = true
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.google.dagger:dagger:2.9'
kapt 'com.google.dagger:dagger-compiler:2.9'
testCompile 'junit:junit:4.12'
}
Kotlin official doc
I trying to add Adobe Creative Sdk into Android app ,I follow this(https://creativesdk.adobe.com/docs/android/#/articles/gettingstarted/index.html) tutorial ,but when I synic the project following error show on logcat...
C:\Users\Muzamil Hussain\AndroidStudioProjects\SwitchApp\app\build\intermediates\res\merged\debug\values\values.xml
Error:(2599, 44) No resource found that matches the given name (at 'android:textColorHint' with value '#color/hint_foreground_material_light').
Error:(2599, 44) No resource found that matches the given name (at 'android:textColorHint' with value '#color/hint_foreground_material_light').
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
for value.xml file.
my gradle app file:
apply plugin: 'com.android.application'
/* 1) Apply the Gradle Retrolambda Plugin */
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 24
buildToolsVersion '24.0.3'
defaultConfig {
applicationId "com.example.muzamil_hussain.switchapp"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [appPackageName: "dfc,,,,myapi key........mmmm"]
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
/* 2) Compile for Java 1.8 or greater */
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
/* 3) Exclude duplicate licenses */
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
pickFirst 'AndroidManifest.xml'
}
// This is handled for you by the 2.0+ Gradle Plugin
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.0.3'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-database:9.8.0'
compile 'com.google.firebase:firebase-core:9.8.0'
compile 'com.google.firebase:firebase-auth:9.8.0'
compile 'com.google.firebase:firebase-storage:9.8.0'
compile 'com.google.firebase:firebase-crash:9.8.0'
compile 'com.google.firebase:firebase-messaging:9.8.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5]'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.firebase:firebase-client-android:2.5.2'
compile 'com.firebaseui:firebase-ui:0.6.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.github.QuadFlask:colorpicker:0.0.12'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.7.4'
compile 'com.adobe.creativesdk.foundation:auth:0.9.1186'
compile 'com.adobe.creativesdk:image:4.6.3'
compile 'com.localytics.android:library:3.8.0'
}
apply plugin: 'com.google.gms.google-services'
and this build.gradle(project: name)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
/* 1) Add the Gradle Retrolambda Plugin */
classpath 'me.tatarka:gradle-retrolambda:3.3.0-beta4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
/* 2) Add mavenCentral */
mavenCentral()
/* 3) Add the Creative SDK Maven repo URL */
maven {
url 'https://repo.adobe.com/nexus/content/repositories/releases/'
}
maven {
url 'http://maven.localytics.com/public'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Enable android support.
Go to File>Settings>Plugins then enable it.
I have an app with Android annotations that is giving me a NoClassDefFoundError when I try to run it.
java.lang.NoClassDefFoundError: br.socialcondo.app.rest.services.UserService_
In the annotations log I can see that this class is generated:
Note: Generating class: br.socialcondo.app.rest.services.UserService_
What I am doing wrong here?
EDIT
Sharing build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "http://dl.bintray.com/populov/maven" }
maven { url "https://repo.commonsware.com.s3.amazonaws.com" }
mavenCentral()
}
configurations {
apt
}
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
versionCode 30
versionName "2.0.0"
multiDexEnabled true
}
signingConfigs {
release {
storeFile file("xxx")
storePassword "xxx"
keyAlias "xxx"
keyPassword "xxx"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
buildTypes {
release {
ext.betaDistributionGroupAliases = "devs"
minifyEnabled false
signingConfig signingConfigs.release
}
}
productFlavors {
production {
applicationId "br.socialcondo.app"
}
development {
applicationId "br.socialcondo.app"
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
}
}
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName 'br.socialcondo.app'
}
}
dependencies {
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile group: 'com.google.guava', name: 'guava', version: '11.0.2'
// You must install or update the Google Repository through the SDK manager to use this dependency.
// The Google Repository (separate from the corresponding library) can be found in the Extras category.
// compile 'com.google.android.gms:play-services:4.2.42'
// You must install or update the Google Repository through the SDK manager to use this dependency.
// The Google Repository (separate from the corresponding library) can be found in the Extras category.
//
apt 'org.androidannotations:androidannotations:3.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':libraries:facebook')
compile project(':libraries:caldroid')
compile 'org.codehaus.jackson:jackson-jaxrs:1.9.13'
compile 'org.androidannotations:androidannotations-api:3.2'
compile 'com.google.android.gms:play-services:6.1.+'
compile 'com.android.support:support-v4:22.1.1'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:recyclerview-v7:22.1.1'
compile 'com.android.support:gridlayout-v7:22.1.1'
compile 'de.greenrobot:greendao:1.3.7'
compile 'com.koushikdutta.urlimageviewhelper:urlimageviewhelper:1.0.4'
compile('com.crashlytics.sdk.android:crashlytics:2.2.4#aar') {
transitive = true
}
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.makeramen:roundedimageview:1.5.0'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'com.kbeanie:image-chooser-library:1.4.02#aar'
compile 'com.github.chrisbanes.photoview:library:1.2.3'
compile 'com.commonsware.cwac:endless:1.2.3'
compile 'com.malinskiy:superrecyclerview:1.1.0'
}
EDIT 2
Root build.gradle
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
classpath 'io.fabric.tools:gradle:1.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
The problem is with
multiDexEnabled true
It is only supported on Android 5 natively. So I need a library for this
to run in older versions. I found the fix.