Kotlin / anko

Pleasant Android application development
Apache License 2.0
15.89k stars 1.29k forks source link

AndroidX make in error Anko because searching for supportLibrary #686

Closed jewom closed 5 years ago

jewom commented 5 years ago

I try to put AndroidX in my project so the support library classes doesn't exist anymore and when I try to make a custom dialog alert, I have this error : cannot access class android.support.design.widget.TextInputLayout check your module classpath for missing or conflicting dependencies

This is my code :

class SendReceiptDialog(ui: AnkoContext<View>) {

    lateinit var dialog: DialogInterface
    lateinit var feedbackText: TextInputEditText
    lateinit var cancelButton: TextView
    lateinit var okButton: TextView

    init {
        with(ui) {
            dialog = alert {
                customView {
                    verticalLayout {
                        padding = dip(16)

                        textView(R.string.Receipt) {}
                        textView(R.string.please_type_in_the_email_address) {}

                        textInputLayout {
                            hint = "Email"
                            feedbackText = textInputEditText {
                                textSize = 16f
                                inputType = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS
                            }
                        }

                    }
                }
            }.show()
        }
    }
}

This is my Gradle :

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "my.app"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0.1"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.core:core-ktx:1.0.0'

    implementation 'androidx.multidex:multidex:2.0.0'

    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'

    implementation "org.jetbrains.anko:anko-commons:0.10.5"
    implementation "org.jetbrains.anko:anko-design:0.10.4"
    implementation "org.jetbrains.anko:anko-sdk25:0.10.5"
    implementation "com.chibatching.kotpref:kotpref:2.5.0"
    implementation "com.chibatching.kotpref:initializer:2.5.0"

    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'

    implementation "androidx.room:room-runtime:2.1.0-alpha01"
    annotationProcessor "androidx.room:room-compiler:2.1.0-alpha01"
    kapt "androidx.room:room-compiler:2.1.0-alpha01"

    implementation 'com.stripe:stripe-android:8.0.0'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.stripe:stripe-android:8.0.0'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
    implementation 'io.reactivex.rxjava2:rxkotlin:2.2.0'

    implementation 'io.card:android-sdk:5.5.0'

    // Smooch
    implementation 'io.smooch:core:5.14.3'
    implementation 'io.smooch:ui:5.14.3'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.squareup.okhttp3:okhttp:3.11.0'
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'androidx.annotation:annotation:1.0.0'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    implementation 'androidx.exifinterface:exifinterface:1.0.0'
    implementation 'androidx.media:media:1.0.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'
}

apply plugin: 'com.google.gms.google-services'

capture d ecran 2018-10-26 a 18 42 47

kiratheone commented 5 years ago

ive had that error before

im using anko 0.10.7 with latest gradle, androidx and Android Studio and then that error is gone or you can Create Extensions androidx support for yourself

see also #634 for reference

ghosalmartin commented 5 years ago

the latest jetifier beta fixed most of these issues

jewom commented 5 years ago

Great!

iceboundrock commented 5 years ago

Hi @jewom , if you fixed these problems, would you mind closing this issue? Thank you.

jewom commented 5 years ago

Yes thanks !