I have following build.gradle file under project :
buildscript {
ext.kotlin_version = '1.3.11'
ext.gradle_version = '3.2.1'
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:$gradle_version"
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 {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And here is my build.gradle under app module:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
androidExtensions {
experimental = true
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.sample.android.tmdb"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
buildConfigField "String", "TMDB_API_KEY", "\"${getProperty("local.properties", "tmdb_api_key")}\""
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Support libraries
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
implementation "com.android.support:design:$supportLibraryVersion"
implementation "com.android.support:recyclerview-v7:$supportLibraryVersion"
implementation "com.android.support:cardview-v7:$supportLibraryVersion"
implementation "com.android.support:palette-v7:$supportLibraryVersion"
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha2'
// Architecture components
implementation "android.arch.paging:runtime:$pagingVersion"
implementation "android.arch.lifecycle:runtime:$lifecycleVersion"
implementation "android.arch.lifecycle:extensions:$lifecycleVersion"
// Gson
implementation 'com.google.code.gson:gson:2.8.5'
// Retrofit
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
// Dagger
implementation "com.google.dagger:dagger:$daggerVersion"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
implementation "com.google.dagger:dagger-android:$daggerVersion"
implementation "com.google.dagger:dagger-android-support:$daggerVersion"
kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
//Android RX
implementation "io.reactivex.rxjava2:rxjava:$rxjavaVersion"
implementation "io.reactivex.rxjava2:rxandroid:$rxandroidVersion"
// Network
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation "com.github.bumptech.glide:glide:$glideVersion"
kapt "com.github.bumptech.glide:compiler:$glideVersion"
// Timber
implementation 'com.jakewharton.timber:timber:4.7.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
def getProperty(String filename, String propName) {
def propsFile = rootProject.file(filename)
if (propsFile.exists()) {
def props = new Properties()
props.load(new FileInputStream(propsFile))
if (props[propName] != null) {
return props[propName]
} else {
print("No such property " + propName + " in file " + filename)
}
} else {
print(filename + " does not exist!")
}
}
I get following error when I build the project :
Failed to resolve: adapters
Failed to resolve: library
Failed to resolve: runtime
Failed to resolve: palette-v7
Failed to resolve: common
How can I resolve it?
Project can be found at : https://github.com/Ali-Rezaei/TMDb-Paging
Addenda:
I just change 4.6 version to 4.4:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
And gradle_version = '3.1.4' and it worked as expected.
Related
I am trying to update dependencies in build.gradle , but they fail to update and a message like this is always shown
Failed to resolve: ***********
Unresolved dependencies
Could not resolve**************
Note:
No proxy is set
Offline Mode is disabled
When I try to update the dependencies , it starts downloading and after some minutes, it shows an error message ..
I tried to change proxy settings to Auto-Detect , but the same problem keeps occurring
Please help
ext {
var = '54642664'
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
classpath 'com.google.gms:google-services:4.3.13'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
buildscript {
repositories {
google()
mavenCentral()
}
}
allprojects {
repositories {
google()
mavenCentral()
maven{ url 'https://jitpack.io'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
repositories {
mavenCentral()
}
android {
compileSdkVersion 32
buildToolsVersion "30.0.3"
bundle{
language{
enableSplit = false
}
}
defaultConfig {
applicationId "com.afeefinc.electricityinverter"
minSdkVersion 19
targetSdkVersion 32
versionCode 101
versionName "3.9.20"
multiDexEnabled true
resConfigs 'en', 'ar', 'es', 'tr', 'hi', 'ru', 'fr', 'fil', 'zh', 'fa', 'bn', 'de', 'in', 'ur', 'af', 'pt', 'it', 'my', 'uk', 'ro', 'el', 'vi', 'th', 'ja', 'iw', 'ku', 'ko', 'nl'
//Define languages that your app supports.
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
namespace 'com.afeefinc.electricityinverter'
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.5.0'
implementation 'androidx.navigation:navigation-ui:2.5.0'
implementation 'org.jetbrains:annotations:22.0.0'
implementation 'com.google.android.gms:play-services-location:20.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.github.philJay:MPandroidChart:v3.1.0'
implementation 'com.google.firebase:firebase-inappmessaging-display'
implementation platform('com.google.firebase:firebase-bom:30.0.0')
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-database'
implementation 'com.google.firebase:firebase-firestore'
implementation 'com.google.firebase:firebase-auth'
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.google.android.gms:play-services-ads:21.0.0'
implementation("com.android.billingclient:billing:5.0.0")
implementation 'com.google.firebase:firebase-dynamic-module-support:16.0.0-beta02'
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.lifecycle:lifecycle-runtime:2.5.0"
annotationProcessor "androidx.lifecycle:lifecycle-common-java8:2.5.0"
implementation 'com.anjlab.android.iab.v3:library:2.0.0'
implementation 'androidx.work:work-runtime-ktx:2.8.0-alpha02'
implementation 'com.github.bumptech.glide:glide:4.13.0'
implementation 'com.google.firebase:firebase-analytics'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.0'
implementation 'com.github.jd-alexander:LikeButton:0.2.3'
// annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.4.1"
implementation "android.arch.lifecycle:common-java8:1.1.1"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
With this error : DefaultTaskContainer#register(String, Class, Action) on task set cannot be executed in the current context.
No details is shown in the IDE but Android Studio is failing to run the application after getting updated. I am using android studio for developing one of my project. All the sudden the issue occurred.
Here are my gradle files:
Project Level :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.0'
repositories {
google()
jcenter()
// Add repository
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0-alpha02'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.firebase:firebase-core:16.0.5'
// Check for v3.1.2 or higher
classpath 'com.google.gms:google-services:4.2.0'
// Add dependency
classpath 'io.fabric.tools:gradle:1.25.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app level :
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.bendroidappsn.***"
minSdkVersion 15
targetSdkVersion 28
multiDexEnabled true
versionCode 24
versionName "APPLE"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
lintOptions {
checkReleaseBuilds false
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-multidex-rules.pro'
}
}
}
ext {
//supportLibraryVersion = '28.0.0-rc01'
supportLibraryVersion = '28.0.0'
playServicesVersion = '17.0.0'
}
dependencies {
implementation "com.google.android.gms:play-services-ads:$playServicesVersion"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'android.arch.navigation:navigation-fragment:1.0.0-alpha07'
implementation 'android.arch.navigation:navigation-ui:1.0.0-alpha07'
implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha07'
implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0-alpha07'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-firestore:17.1.2'
implementation 'com.android.support:gridlayout-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.firebase:firebase-config:16.1.0'
// Add dependency
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
compile 'com.android.support:multidex:1.0.3'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
//if(!details.equals(com.android.support:multidex)) {
if (!requested.name.startsWith("multidex")) {
details.useVersion "$supportLibraryVersion"
}
}
}
}
repositories {
mavenCentral()
}
Try to set
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
in the file gradle-wrapper.properties
that works for me
I ran into this exact issue after updating to Android Studio 3.4 Canary 4.
Disabling instant run fixed it.
Try to update classpath 'com.android.tools.build:gradle:3.4.0-alpha02' to the newest, it works for me.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.bendroidappsn.***"
minSdkVersion 15
targetSdkVersion 28
multiDexEnabled true
versionCode 24
versionName "APPLE"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
lintOptions {
checkReleaseBuilds false
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-multidex-rules.pro'
}
}
}
ext {
//supportLibraryVersion = '28.0.0-rc01'
supportLibraryVersion = '28.0.0'
playServicesVersion = '17.0.0'
}
dependencies {
implementation "com.google.android.gms:play-services-ads:$playServicesVersion"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'android.arch.navigation:navigation-fragment:1.0.0-alpha07'
implementation 'android.arch.navigation:navigation-ui:1.0.0-alpha07'
implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha07'
implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0-alpha07'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-firestore:17.1.2'
implementation 'com.android.support:gridlayout-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.firebase:firebase-config:16.1.0'
// Add dependency
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
compile 'com.android.support:multidex:1.0.3'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
//if(!details.equals(com.android.support:multidex)) {
if (!requested.name.startsWith("multidex")) {
details.useVersion "$supportLibraryVersion"
}
}
}
}
repositories {
mavenCentral()
}
i recently updated google services to 3.3.0:
classpath 'com.google.gms:google-services:3.3.0'
Now i have the following error and the recommendation from google here is to upgrade to 3.3.0 for the new firebase versioning.
here is the error:
As you can see its failing during the configuration phase.
if i look at the build error details i see the following :
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:89)
at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:70)
at org.gradle.configuration.project.LifecycleProjectEvaluator.access$100(LifecycleProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator$ConfigureProject.run(LifecycleProjectEvaluator.java:110)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:50)
here are the details of my project gradle file:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
google()
}
//kotlin version
ext.kotlin_version = '1.2.41'
ext.kotlin_ktx_version = '0.3'
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.3.0'
classpath 'io.fabric.tools:gradle:1.25.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "http://dl.bintray.com/pt-midtrans/maven" }
maven { url "https://jitpack.io" }
google()
}
project.ext {
minimumSdkVersion = 16
supportlib_version = '27.1.1'
room_version = '1.0.0'
espresso_version = '3.0.1'
archLifecycleVersion = '1.1.1'
dagger = '2.15'
}
}
subprojects {
//todo change this to loop once
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex')) {
details.useVersion "$supportlib_version" //force all versions of support library to be the same. i tried commending out this entire block but that is not the issue
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and the app gradle file:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 27
//buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion project.ext.minimumSdkVersion
//check top level build.gradle file for attributes -
targetSdkVersion 27
applicationId "com.mobile.mypackage"
versionCode 1
versionName "3" //whatever
testInstrumentationRunner "com.mobile.mypackage.base.MyTestRunner"
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions 'tier'
buildTypes {
release {
debuggable false //for troubleshooting, should set to false in production build
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-fresco.pro', 'proguard-gson.pro', 'proguard-midtrans.pro'
}
debugMini {
//this is a proguarded version of debug build, turn off - InstaRun to use
initWith debug
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-fresco.pro', 'proguard-gson.pro', 'proguard-midtrans.pro'
matchingFallbacks = ['debug']
}
}
dexOptions {
//for out of memory gc overhead error
javaMaxHeapSize "6g"
}
lintOptions {
abortOnError false
}
androidExtensions {
experimental = true
}
testOptions {
//this seems to be absolutely nothing in build tools 25.0.3. after upgrading gradle will check again
animationsDisabled = true
execution 'ANDROID_TEST_ORCHESTRATOR'
}
productFlavors {
def STRING = "String"
def BOOLEAN = "boolean"
def TRUE = "true"
def FALSE = "false"
def BASE_ENDPOINT = "BASE_ENDPOINT"
staging {
dimension 'tier'
buildConfigField STRING, BASE_ENDPOINT, '"https://api.myendpoint.com"'
versionNameSuffix '-STAGING'
applicationIdSuffix 'staging'
}
labs {
dimension 'tier'
ext.alwaysUpdateBuildId = false
buildConfigField STRING, BASE_ENDPOINT, '"https://api.myendpoint.com"'
versionNameSuffix '-LABs'
applicationIdSuffix 'labs'
}
prod {
dimension 'tier'
buildConfigField STRING, BASE_ENDPOINT, '"https://api.myendpoint.com"'
}
}
}
kapt {
useBuildCache = false //toggle this to see if it will help
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation("com.android.support:appcompat-v7:$supportlib_version") {
force = true
}
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation "com.android.support:support-annotations:$supportlib_version"
implementation("com.android.support:design:$supportlib_version") {
force = true
}
implementation 'com.android.support:multidex:1.0.3'
//firebase
implementation("com.google.firebase:firebase-core:15.0.2") {
force = true
}
implementation("com.google.firebase:firebase-auth:15.1.0") {
force = true
}
implementation("com.google.firebase:firebase-config:15.0.2") {
force = true
}
implementation("com.google.android.gms:play-services-auth:15.0.0") {
force = true
}
implementation("com.google.firebase:firebase-messaging:15.0.2") {
force = true
}
//rxjava
implementation 'io.reactivex.rxjava2:rxjava:2.1.6'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
//square
//testAnnotationProcessor "com.google.dagger:dagger-compiler:$dagger"
implementation "com.google.dagger:dagger:$dagger"
//annotationProcessor "com.google.dagger:dagger-compiler:$dagger"
kapt "com.google.dagger:dagger-compiler:$dagger"
implementation 'com.github.ajalt:timberkt:1.3.0'
implementation 'com.jakewharton:butterknife:8.8.1'
// annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
kapt 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation "com.squareup.retrofit2:retrofit:2.3.0"
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation "com.squareup.retrofit2:converter-gson:2.3.0"
androidTestImplementation 'com.squareup.rx.idler:rx2-idler:0.9.0' //for espresso
implementation 'com.hannesdorfmann.mosby:viewstate:2.0.1'
//------Architecture Components ------------
//room db
implementation "android.arch.persistence.room:runtime:$room_version"
//annotationProcessor "android.arch.persistence.room:compiler:$room_version"
implementation "android.arch.lifecycle:common-java8:1.1.1"
kapt "android.arch.persistence.room:compiler:$room_version"
implementation "android.arch.persistence.room:rxjava2:$room_version"
// Lifecycles only (no ViewModel or LiveData)
implementation "android.arch.lifecycle:runtime:$archLifecycleVersion"
//annotationProcessor "android.arch.lifecycle:compiler:$archLifecycleVersion"
kapt "android.arch.lifecycle:compiler:$archLifecycleVersion"
implementation "android.arch.lifecycle:extensions:$archLifecycleVersion"
//------END Architecture Components ------------
//event Bus
implementation 'org.greenrobot:eventbus:3.0.0'
//FB
implementation 'com.facebook.android:facebook-android-sdk:4.32.0'
//implementation 'com.facebook.android:facebook-applinks:[4,5)'
implementation 'com.facebook.fresco:fresco:1.3.0'
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
//testing
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
testImplementation 'org.mockito:mockito-core:2.15.0'
androidTestImplementation 'org.mockito:mockito-android:2.8.9'
androidTestImplementation 'com.github.fabioCollini:DaggerMock:0.8.4'
implementation 'com.squareup.okhttp3:mockwebserver:3.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
// Espresso dependencies
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espresso_version"
androidTestImplementation "com.android.support.test.espresso:espresso-contrib:$espresso_version"
androidTestImplementation "com.android.support.test.espresso:espresso-intents:$espresso_version"
// androidTestImplementation 'com.android.support.test.espresso:espresso-accessibility:3.0.1'
androidTestImplementation "com.android.support.test.espresso:espresso-web:$espresso_version"
androidTestImplementation "com.android.support.test.espresso.idling:idling-concurrent:$espresso_version"
androidTestImplementation "com.android.support.test.espresso:espresso-idling-resource:$espresso_version"
//UI dependencies
implementation 'com.andreabaccega:android-edittext-validator:1.3.4'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation "com.imgix:imgix-java:1.1.10"
implementation 'com.github.markomilos:paginate:0.5.1'
implementation 'com.sprylab.android.texturevideoview:texturevideoview:1.2.1'
implementation 'com.balysv:material-ripple:1.0.2'
implementation 'com.github.d-max:spots-dialog:0.7#aar' //loading screen
implementation 'com.jaredrummler:material-spinner:1.1.0'//drop down list
implementation 'com.github.ganfra:material-spinner:1.1.1'//drop down list
implementation 'com.bartoszlipinski:recyclerviewheader2:2.0.1'
//implementation 'com.github.takusemba:multisnaprecyclerview:1.1.1' //snap
implementation 'com.crystal:crystalrangeseekbar:1.1.1'
implementation 'com.github.faruktoptas:FancyShowCaseView:1.0.0'
//data structures
implementation 'com.scalified:tree:0.2.4'
//parcelable
implementation 'org.parceler:parceler-api:1.1.9'
//annotationProcessor 'org.parceler:parceler:1.1.9'
kapt 'org.parceler:parceler:1.1.9'
//payment gateways
//implementation 'co.omise:omise-android:2.3.+'
implementation 'co.omise:omise-android:2.6.4'
implementation 'com.braintreepayments.api:braintree:1.+'
debugImplementation 'com.midtrans:uikit:1.17.0-SANDBOX'
debugMiniImplementation 'com.midtrans:uikit:1.17.0-SANDBOX'
releaseImplementation 'com.midtrans:uikit:1.17.0'
//fresh chat
implementation 'com.github.freshdesk:freshchat-android:1.3.1'
implementation'com.crashlytics.sdk.android:crashlytics:2.9.2'
//one signal
implementation 'com.onesignal:OneSignal:[3.7.1, 3.99.99]'
//retrofit pretty logs
implementation('com.github.ihsanbal:LoggingInterceptor:2.0.2') {
exclude group: 'org.json', module: 'json'
}
//barcode scanner
implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
//masking text
implementation 'com.redmadrobot:inputmask:2.3.0'
// Analytics
implementation "com.google.android.gms:play-services-analytics:15.0.2"
implementation 'com.appsflyer:af-android-sdk:4+#aar'
implementation 'com.android.installreferrer:installreferrer:1.0'
//runtime permissions
implementation 'com.karumi:dexter:4.2.0'
//chrome custom tabs
implementation 'saschpe.android:customtabs:1.0.9'
//searching - https://github.com/algolia/algoliasearch-client-android/releases
implementation 'com.algolia:algoliasearch-android:3.21.11'
//credit card scanner
implementation 'io.card:android-sdk:5.5.1'
//firebase test orchestrator
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestUtil 'com.android.support.test:orchestrator:1.0.2'
//kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
//kotlin ktx
implementation "androidx.core:core-ktx:$kotlin_ktx_version"
}
apply plugin: 'com.google.gms.google-services' //add to bottom of file
if i downgrade to 3.2.1 i get the following build error:
5 [ERROR] [com.android.build.gradle.internal.transforms.DesugarTransform] Exception in thread "main" java.lang.IllegalArgumentException
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer$DefaultMethodFinder.visit(DefaultMethodClassFixer.java:483)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:621)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:331)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:91)
at org.objectweb.asm.ClassVisitor.visitEnd(ClassVisitor.java:339)
at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:112)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:702)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:477)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:361)
at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:314)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:711)
UPDATE:
AFTER downgrading to google services 3.2.1 i now face the following error while build the gradle project:
14:37:49.269 [ERROR] [com.android.build.gradle.internal.transforms.DesugarTransform] Exception in thread "main" java.lang.IllegalArgumentException
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer$DefaultMethodFinder.visit(DefaultMethodClassFixer.java:483)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:621)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:331)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:91)
at org.objectweb.asm.ClassVisitor.visitEnd(ClassVisitor.java:339)
at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:112)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:702)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:477)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:361)
at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:314)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:711)
UPDATE: It seems when disable oneSignal Sdk the deSugar error disappears on 3.2.0 . so i speculate that this has to do something with firebase versioning. but there is still an issue using 3.3.0. i will contact oneSignal seperately.
I have no idea how to fix this. i am using 4.6 and also tried 4.4 of gradle wrapper (just in case).
use classpath 'com.google.gms:google-services:3.2.0'
I am trying to implement Room into Android application written in Kotlin. After build failing so many times, I pinpointed the problem that it failed when I added #Database into my database class.
package sample.service.local
import android.arch.persistence.room.Database
import android.arch.persistence.room.RoomDatabase
import sample.service.model.Announcement
#Database(entities = [Announcement::class], version = 1)
abstract class AnnounceDatabase: RoomDatabase() {
abstract fun announceDAO(): AnnounceDAO
}
If I commented out the line with #Database it built successfully. Its DAO and Entity files shouldn't be the problem as I tried building with them without #Database and it was successful. I also haven't added them into any other classes; I just created 3 new files which are this database, its dao, and its entity.
Here's build.gradle(Module:app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: "kotlin-kapt"
android {
compileSdkVersion 27
defaultConfig {
applicationId "sample"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
dataBinding.enabled true
}
}
project.ext {
supportLibraryVersion = "26.1.0"
daggerVersion = "2.13"
butterKnifeVersion = "8.8.1"
rxJavaVersion = "2.1.0"
rxAndroidVersion = "2.0.1"
lifecycleVersion = "1.0.0"
roomVersion = "1.0.0"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.android.support:support-v4:27.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
// Android Support Library
implementation 'com.android.support:design:27.1.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:support-annotations:27.1.0'
implementation 'com.android.support:support-compat:27.1.0'
implementation 'com.android.support:support-core-ui:27.1.0'
// Easy Permission
implementation 'pub.devrel:easypermissions:1.2.0'
// Lifecycle
implementation "android.arch.lifecycle:extensions:1.1.0"
annotationProcessor "android.arch.lifecycle:compiler:1.1.0"
// Kotlin binding
// kapt 'com.android.databinding:compiler:3.1.0'
// Dagger core
kapt "com.google.dagger:dagger-compiler:$project.daggerVersion"
implementation "com.google.dagger:dagger:$project.daggerVersion"
// Dagger Android
kapt "com.google.dagger:dagger-android-processor:$project.daggerVersion"
implementation "com.google.dagger:dagger-android-support:$project.daggerVersion"
// Timber
implementation 'com.jakewharton.timber:timber:4.6.0'
// Simple Item Decoration
implementation 'com.bignerdranch.android:simple-item-decoration:1.0.0'
// Retrofit
implementation "com.squareup.retrofit2:retrofit:2.1.0"
implementation "com.squareup.retrofit2:converter-gson:2.1.0"
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
// implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
// RxJava & RxAndroid
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
// PageIndicatorView
implementation 'com.romandanylyk:pageindicatorview:1.0.0#aar'
// Room
implementation "android.arch.persistence.room:rxjava2:$project.roomVersion"
implementation "android.arch.persistence.room:runtime:$project.roomVersion"
kapt "android.arch.persistence.room:compiler:$project.roomVersion"
testImplementation "android.arch.persistence.room:testing:$project.roomVersion"
}
Here's project's gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.31'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
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 {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I ran gradlew clean build --stacktrace --debug and here's error message
Any help will be appreciated.
The problem is in my Entity class where I used val instead of var for the parameters, so I just changed all of them to var and the problem is solved.
Edit: My DAO class also has a problem as well where ArrayList cannot be used instead of List
I've googled and searched in here the solution for this but haven't found it. I just updated my Android Studio to 3.0 and I'm trying to port my app to use feature modules in order to be able to make an Instant App, but when I try to run the app from Android Studio, I get the following error:
Error:Execution failed for task
':app:transformClassesWithStackFramesFixerForDebug'.
> com.android.build.api.transform.TransformException:
java.lang.RuntimeException: java.lang.RuntimeException:
java.util.concurrent.ExecutionException:
java.util.concurrent.ExecutionException:
com.android.builder.utils.FileCache$FileCreatorException:
java.util.zip.ZipException: duplicate entry: META-INF/MANIFEST.MF
I tried to exclude such file using packagingOptions, but apparently is not working. Here are my build.gradle files:
Project build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
ext {
compileSdkVersion = 26
supportLib = '26.1.0'
}
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
App module build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
maven { url "https://s3.amazonaws.com/avocarrot-android-builds/dist" }
maven { url "https://s3.amazonaws.com/moat-sdk-builds" }
maven { url "https://maven.google.com" }
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.myapp.mobile"
minSdkVersion 16
targetSdkVersion 26
versionCode 23004003
versionName "4.0.0.3"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
dexOptions {
javaMaxHeapSize "4g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/rxjava.properties'
exclude 'META-INF/MANIFEST.MF'
}
}
dependencies {
def mopub = '4.16.0#aar'
def avocarrot = '4.6.0'
def exoplayer = 'r2.2.0'
def mobfox = '3.2.3'
def pubnative = '2.0.4'
def facebook = '4.+'
def pubnativeFacebookAdapter = '2.0.2-4.22.1'
def taboola = '1.3.1'
def okhttp = '3.8.1'
def okio = '1.13.0'
def picasso = '2.5.2'
def firebase = '11.4.0'
def playServices = '11.4.0'
def supportLib = '26.1.0'
def gson = '2.8.1'
def circleimageview = '2.1.0'
def floatingactionbutton = '1.3.0'
def mpAndroidChart = 'v3.0.2'
def gridViewHeaderFooter = '1.0.12'
def multidex = '1.0.1'
def floatingsearchview = '2.0.3'
def cropper = '1.0.1#aar'
def adapterdelegates = '3.0.1'
def rxjava = '2.x.y'
def rxandroid = '2.0.1'
def rxjavaAdapter = '2.3.0'
def retrofit = '2.3.0'
def rxbinding = '2.0.0'
def diagonallayout = '1.0.6'
def fabSpeedDial = '1.0.6'
def butterknife = '8.7.0'
def sqlbrite = '2.0.0'
def leakcanary = '1.5.1'
def debugDB = '1.0.1'
def crashlytics = '2.6.8#aar'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation files('libs/admarvel-android-sdk-core-adcolony.jar')
implementation files('libs/libAdapterSDKMoPub.jar')
implementation files('libs/AdMobMediationAdapter.jar')
implementation files('libs/lsmsdkadmobmediationadapter.jar')
implementation files('libs/MobFox-Android-AdMob-Adapter.jar')
implementation files('libs/gcm.jar')
implementation files('libs/achartengine-1.1.0.jar')
implementation files('libs/comscore.jar')
implementation files('libs/hmediaLib-1.3.0.jar')
implementation(name:'adux-1.0.0', ext:'aar')
implementation "com.avocarrot.sdk:mediation-sdk-nativead:$avocarrot"
implementation "com.google.android.exoplayer:exoplayer:$exoplayer"
implementation "com.facebook.android:audience-network-sdk:$facebook"
implementation "com.facebook.android:facebook-android-sdk:$facebook"
implementation "com.google.ads.mediation:facebook:$facebook"
implementation "com.github.mobfox:MobFox-Android-SDK-Core:$mobfox"
implementation "net.pubnative:sdk:$pubnative"
implementation "net.pubnative:sdk.adapter.facebook:$pubnativeFacebookAdapter"
implementation "com.squareup.okhttp3:okhttp:$okhttp"
implementation "com.squareup.okio:okio:$okio"
implementation "com.squareup.picasso:picasso:$picasso"
implementation "com.android.support:cardview-v7:$rootProject.supportLib"
implementation "com.android.support:support-v4:$rootProject.supportLib"
implementation "com.android.support:recyclerview-v7:$rootProject.supportLib"
implementation "com.android.support:design:$rootProject.supportLib"
implementation "com.android.support:customtabs:$rootProject.supportLib"
implementation "com.google.android.gms:play-services-analytics:$playServices"
implementation "com.google.android.gms:play-services-ads:$playServices"
implementation "com.google.android.gms:play-services-wearable:$playServices"
implementation "com.google.code.gson:gson:$gson"
implementation "de.hdodenhof:circleimageview:$circleimageview"
implementation "com.melnykov:floatingactionbutton:$floatingactionbutton"
implementation "com.github.PhilJay:MPAndroidChart:$mpAndroidChart"
implementation "in.srain.cube:grid-view-with-header-footer:$gridViewHeaderFooter"
implementation "com.android.support:multidex:$multidex"
implementation "com.github.arimorty:floatingsearchview:$floatingsearchview"
implementation "com.soundcloud.android:android-crop:$cropper"
implementation "com.hannesdorfmann:adapterdelegates3:$adapterdelegates"
implementation "io.reactivex.rxjava2:rxjava:$rxjava"
implementation "io.reactivex.rxjava2:rxandroid:$rxandroid"
implementation "com.squareup.retrofit2:adapter-rxjava2:$rxjavaAdapter"
implementation "com.squareup.retrofit2:retrofit:$retrofit"
implementation "com.squareup.retrofit2:converter-gson:$retrofit"
implementation "com.squareup.okhttp3:logging-interceptor:$okhttp"
implementation "com.jakewharton.rxbinding2:rxbinding:$rxbinding"
implementation "com.jakewharton.rxbinding2:rxbinding-support-v4:$rxbinding"
implementation "com.github.florent37:diagonallayout:$diagonallayout"
implementation "io.github.yavski:fab-speed-dial:$fabSpeedDial"
implementation "com.google.firebase:firebase-messaging:$firebase"
implementation "com.jakewharton:butterknife:$butterknife"
implementation "com.squareup.sqlbrite2:sqlbrite:$sqlbrite"
annotationProcessor "com.jakewharton:butterknife-compiler:$butterknife"
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary"
testImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary"
debugImplementation "com.amitshekhar.android:debug-db:$debugDB"
implementation("com.crashlytics.sdk.android:crashlytics:$crashlytics")
{
transitive = true
}
implementation(name: 'DebugSettings', ext: 'aar')
wearApp project(':wear')
implementation project(':myapp-base')
}
apply plugin: 'com.google.gms.google-services'
Base module build.gradle
apply plugin: 'com.android.feature'
repositories {
maven { url "https://maven.google.com" }
}
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion '26.0.2'
baseFeature true
defaultConfig {
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
api "com.android.support:appcompat-v7:$rootProject.supportLib"
implementation fileTree(dir: 'libs', include: ['*.jar'])
// testImplementation 'junit:junit:4.12'
// androidTestImplementation 'com.android.support.test:runner:1.0.1'
// androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
application project(':app')
}
You're including the libs directory twice in your app's build.gradle
// Once
implementation fileTree(include: ['*.jar'], dir: 'libs')
// And once more, but more verbose
implementation files('libs/admarvel-android-sdk-core-adcolony.jar')
implementation files('libs/libAdapterSDKMoPub.jar')
implementation files('libs/AdMobMediationAdapter.jar')
implementation files('libs/lsmsdkadmobmediationadapter.jar')
implementation files('libs/MobFox-Android-AdMob-Adapter.jar')
implementation files('libs/gcm.jar')
implementation files('libs/achartengine-1.1.0.jar')
implementation files('libs/comscore.jar')
implementation files('libs/hmediaLib-1.3.0.jar')
This could be where your issue originates. Decide on one way to include these and let me know whether that works.