Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/375.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/196.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 错误:使用Android Studio 3.0 Beta 6进行数据绑定_Java_Android_Android Studio_Data Binding - Fatal编程技术网

Java 错误:使用Android Studio 3.0 Beta 6进行数据绑定

Java 错误:使用Android Studio 3.0 Beta 6进行数据绑定,java,android,android-studio,data-binding,Java,Android,Android Studio,Data Binding,我已经将数据绑定应用到一个在Android Studio 2.3.3中运行良好的项目中,正如我为Android Studio 3.0 Beta 6配置它时,它停止了工作 它找不到任何数据绑定包。我已经在库模块中添加了一些用于数据绑定的基类,这会成为一个问题吗?也请检查proguard文件 注意:我已经尝试了中给出的大多数问题和答案,因此请不要将此标记为重复 注意:底部没有评论中建议的错误。正如我已经说过的,这个项目在AndroidStudio 2.3.3中成功运行 项目构建。渐变: builds

我已经将数据绑定应用到一个在Android Studio 2.3.3中运行良好的项目中,正如我为Android Studio 3.0 Beta 6配置它时,它停止了工作

它找不到任何数据绑定包。我已经在库模块中添加了一些用于数据绑定的基类,这会成为一个问题吗?也请检查proguard文件

注意:我已经尝试了中给出的大多数问题和答案,因此请不要将此标记为重复

注意:底部没有评论中建议的错误。正如我已经说过的,这个项目在AndroidStudio 2.3.3中成功运行

项目构建。渐变:

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta6'
        classpath 'com.google.gms:google-services:3.1.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
        google()
    }
}

project.ext {
    APPLICATION_ID = "com.packagename"
    BUILD_TOOLS_VERSION = "26.0.1"

    COMPILE_SDK_VERSION = 26
    TARGET_SDK_VERSION = 26
    MIN_SDK_VERSION = 19

    VERSION_CODE = 1
    VERSION_NAME = "1.0"

    SUPPORT_LIB_VERSION = "26.1.0"
    RETROFIT_VERSION = "2.3.0"
    GOOGLE_VERSION = "11.2.2"
    GLIDE_VERSION = "3.7.0"
    DATA_BINDING_VERSION = "1.3.3"

    MINIFY_ENABLE = false
    SHRINK_RESOURCES = false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.android.library'

android {
    compileSdkVersion COMPILE_SDK_VERSION
    buildToolsVersion BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion MIN_SDK_VERSION
        targetSdkVersion TARGET_SDK_VERSION

        versionCode VERSION_CODE
        versionName VERSION_NAME
    }
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }
    dataBinding {
        enabled = true
    }
    buildTypes {
        release {
            minifyEnabled MINIFY_ENABLE
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
def supportLibVersion = SUPPORT_LIB_VERSION
def retrofitVersion = RETROFIT_VERSION
def googleVersion = GOOGLE_VERSION
def glideVersion = GLIDE_VERSION
def dataBindingVersion = DATA_BINDING_VERSION
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:appcompat-v7:$supportLibVersion"
    implementation "com.android.support:design:$supportLibVersion"

    implementation "com.android.databinding:library:$dataBindingVersion"
    implementation "com.android.databinding:adapters:$dataBindingVersion"

    implementation("com.google.firebase:firebase-messaging:$googleVersion") {
        exclude group: 'com.android.support', module: 'support-v4'
    }

    //Retrofit
    implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"

    //OkHttp Interceptor
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'

    //RxJava
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.1'

    implementation "com.github.bumptech.glide:glide:$glideVersion"
}
apply plugin: 'com.android.library'

android {
    compileSdkVersion COMPILE_SDK_VERSION
    buildToolsVersion BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion MIN_SDK_VERSION
        targetSdkVersion TARGET_SDK_VERSION

        versionCode VERSION_CODE
        versionName VERSION_NAME
    }
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }
    dataBinding {
        enabled = true
    }
    buildTypes {
        release {
            minifyEnabled MINIFY_ENABLE
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
def supportLibVersion = SUPPORT_LIB_VERSION
def retrofitVersion = RETROFIT_VERSION
def googleVersion = GOOGLE_VERSION
def glideVersion = GLIDE_VERSION
def dataBindingVersion = DATA_BINDING_VERSION
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:appcompat-v7:$supportLibVersion"
    implementation "com.android.support:design:$supportLibVersion"

    implementation "com.android.databinding:library:$dataBindingVersion"
    implementation "com.android.databinding:adapters:$dataBindingVersion"

    implementation("com.google.firebase:firebase-messaging:$googleVersion") {
        exclude group: 'com.android.support', module: 'support-v4'
    }

    //Retrofit
    implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"

    //OkHttp Interceptor
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'

    //RxJava
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.1'

    implementation "com.github.bumptech.glide:glide:$glideVersion"
}
-keep class com.support.** { *; }

#Retrofit Start
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on RoboVM on iOS. Will not be used at runtime.
-dontnote retrofit2.Platform$IOS$MainThreadExecutor
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
#if using @Header or @Query
-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}

#GSON
-keep class com.google.gson.** { *; }
-keep class com.google.inject.** { *; }
-keep class org.apache.http.** { *; }
-keep class javax.inject.** { *; }
-keep class retrofit.** { *; }
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }
-keepclassmembernames interface * {
    @retrofit.http.* <methods>;
}
-keep interface retrofit.** { *;}
-keep interface com.squareup.** { *; }
-dontwarn rx.**
-dontwarn retrofit.**

#retrofit models
-keep class com.google.gson.examples.android.model.** { *; }
-keep class com.support.retrofit.model.** { *; }

-keepattributes InnerClasses
-keepattributes Deprecated
-keepattributes EnclosingMethod
-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions
#Retrofit End

-keep public class * extends java.lang.Exception

#Fabric
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**

#Glide
-dontwarn java.nio.file.**
-dontwarn org.codehaus.mojo.animal_sniffer.**

#Glide Module
-keep class com.bumptech.glide.GeneratedAppGlideModuleImpl
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.AppGlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}
-keep class com.bumptech.glide.integration.okhttp3.OkHttpGlideModule

#Support Library
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }

#DataBinding
-dontwarn android.databinding.**
-keep class android.databinding.** { *; }
-keep class <com.support>.databinding.** {
    <fields>;
    <methods>;
}
应用程序模块构建。渐变:

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta6'
        classpath 'com.google.gms:google-services:3.1.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
        google()
    }
}

project.ext {
    APPLICATION_ID = "com.packagename"
    BUILD_TOOLS_VERSION = "26.0.1"

    COMPILE_SDK_VERSION = 26
    TARGET_SDK_VERSION = 26
    MIN_SDK_VERSION = 19

    VERSION_CODE = 1
    VERSION_NAME = "1.0"

    SUPPORT_LIB_VERSION = "26.1.0"
    RETROFIT_VERSION = "2.3.0"
    GOOGLE_VERSION = "11.2.2"
    GLIDE_VERSION = "3.7.0"
    DATA_BINDING_VERSION = "1.3.3"

    MINIFY_ENABLE = false
    SHRINK_RESOURCES = false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.android.library'

android {
    compileSdkVersion COMPILE_SDK_VERSION
    buildToolsVersion BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion MIN_SDK_VERSION
        targetSdkVersion TARGET_SDK_VERSION

        versionCode VERSION_CODE
        versionName VERSION_NAME
    }
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }
    dataBinding {
        enabled = true
    }
    buildTypes {
        release {
            minifyEnabled MINIFY_ENABLE
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
def supportLibVersion = SUPPORT_LIB_VERSION
def retrofitVersion = RETROFIT_VERSION
def googleVersion = GOOGLE_VERSION
def glideVersion = GLIDE_VERSION
def dataBindingVersion = DATA_BINDING_VERSION
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:appcompat-v7:$supportLibVersion"
    implementation "com.android.support:design:$supportLibVersion"

    implementation "com.android.databinding:library:$dataBindingVersion"
    implementation "com.android.databinding:adapters:$dataBindingVersion"

    implementation("com.google.firebase:firebase-messaging:$googleVersion") {
        exclude group: 'com.android.support', module: 'support-v4'
    }

    //Retrofit
    implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"

    //OkHttp Interceptor
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'

    //RxJava
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.1'

    implementation "com.github.bumptech.glide:glide:$glideVersion"
}
apply plugin: 'com.android.library'

android {
    compileSdkVersion COMPILE_SDK_VERSION
    buildToolsVersion BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion MIN_SDK_VERSION
        targetSdkVersion TARGET_SDK_VERSION

        versionCode VERSION_CODE
        versionName VERSION_NAME
    }
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }
    dataBinding {
        enabled = true
    }
    buildTypes {
        release {
            minifyEnabled MINIFY_ENABLE
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
def supportLibVersion = SUPPORT_LIB_VERSION
def retrofitVersion = RETROFIT_VERSION
def googleVersion = GOOGLE_VERSION
def glideVersion = GLIDE_VERSION
def dataBindingVersion = DATA_BINDING_VERSION
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:appcompat-v7:$supportLibVersion"
    implementation "com.android.support:design:$supportLibVersion"

    implementation "com.android.databinding:library:$dataBindingVersion"
    implementation "com.android.databinding:adapters:$dataBindingVersion"

    implementation("com.google.firebase:firebase-messaging:$googleVersion") {
        exclude group: 'com.android.support', module: 'support-v4'
    }

    //Retrofit
    implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"

    //OkHttp Interceptor
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'

    //RxJava
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.1'

    implementation "com.github.bumptech.glide:glide:$glideVersion"
}
-keep class com.support.** { *; }

#Retrofit Start
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on RoboVM on iOS. Will not be used at runtime.
-dontnote retrofit2.Platform$IOS$MainThreadExecutor
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
#if using @Header or @Query
-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}

#GSON
-keep class com.google.gson.** { *; }
-keep class com.google.inject.** { *; }
-keep class org.apache.http.** { *; }
-keep class javax.inject.** { *; }
-keep class retrofit.** { *; }
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }
-keepclassmembernames interface * {
    @retrofit.http.* <methods>;
}
-keep interface retrofit.** { *;}
-keep interface com.squareup.** { *; }
-dontwarn rx.**
-dontwarn retrofit.**

#retrofit models
-keep class com.google.gson.examples.android.model.** { *; }
-keep class com.support.retrofit.model.** { *; }

-keepattributes InnerClasses
-keepattributes Deprecated
-keepattributes EnclosingMethod
-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions
#Retrofit End

-keep public class * extends java.lang.Exception

#Fabric
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**

#Glide
-dontwarn java.nio.file.**
-dontwarn org.codehaus.mojo.animal_sniffer.**

#Glide Module
-keep class com.bumptech.glide.GeneratedAppGlideModuleImpl
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.AppGlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}
-keep class com.bumptech.glide.integration.okhttp3.OkHttpGlideModule

#Support Library
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }

#DataBinding
-dontwarn android.databinding.**
-keep class android.databinding.** { *; }
-keep class <com.support>.databinding.** {
    <fields>;
    <methods>;
}
支持模块构建。渐变:

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta6'
        classpath 'com.google.gms:google-services:3.1.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
        google()
    }
}

project.ext {
    APPLICATION_ID = "com.packagename"
    BUILD_TOOLS_VERSION = "26.0.1"

    COMPILE_SDK_VERSION = 26
    TARGET_SDK_VERSION = 26
    MIN_SDK_VERSION = 19

    VERSION_CODE = 1
    VERSION_NAME = "1.0"

    SUPPORT_LIB_VERSION = "26.1.0"
    RETROFIT_VERSION = "2.3.0"
    GOOGLE_VERSION = "11.2.2"
    GLIDE_VERSION = "3.7.0"
    DATA_BINDING_VERSION = "1.3.3"

    MINIFY_ENABLE = false
    SHRINK_RESOURCES = false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.android.library'

android {
    compileSdkVersion COMPILE_SDK_VERSION
    buildToolsVersion BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion MIN_SDK_VERSION
        targetSdkVersion TARGET_SDK_VERSION

        versionCode VERSION_CODE
        versionName VERSION_NAME
    }
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }
    dataBinding {
        enabled = true
    }
    buildTypes {
        release {
            minifyEnabled MINIFY_ENABLE
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
def supportLibVersion = SUPPORT_LIB_VERSION
def retrofitVersion = RETROFIT_VERSION
def googleVersion = GOOGLE_VERSION
def glideVersion = GLIDE_VERSION
def dataBindingVersion = DATA_BINDING_VERSION
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:appcompat-v7:$supportLibVersion"
    implementation "com.android.support:design:$supportLibVersion"

    implementation "com.android.databinding:library:$dataBindingVersion"
    implementation "com.android.databinding:adapters:$dataBindingVersion"

    implementation("com.google.firebase:firebase-messaging:$googleVersion") {
        exclude group: 'com.android.support', module: 'support-v4'
    }

    //Retrofit
    implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"

    //OkHttp Interceptor
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'

    //RxJava
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.1'

    implementation "com.github.bumptech.glide:glide:$glideVersion"
}
apply plugin: 'com.android.library'

android {
    compileSdkVersion COMPILE_SDK_VERSION
    buildToolsVersion BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion MIN_SDK_VERSION
        targetSdkVersion TARGET_SDK_VERSION

        versionCode VERSION_CODE
        versionName VERSION_NAME
    }
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }
    dataBinding {
        enabled = true
    }
    buildTypes {
        release {
            minifyEnabled MINIFY_ENABLE
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
def supportLibVersion = SUPPORT_LIB_VERSION
def retrofitVersion = RETROFIT_VERSION
def googleVersion = GOOGLE_VERSION
def glideVersion = GLIDE_VERSION
def dataBindingVersion = DATA_BINDING_VERSION
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:appcompat-v7:$supportLibVersion"
    implementation "com.android.support:design:$supportLibVersion"

    implementation "com.android.databinding:library:$dataBindingVersion"
    implementation "com.android.databinding:adapters:$dataBindingVersion"

    implementation("com.google.firebase:firebase-messaging:$googleVersion") {
        exclude group: 'com.android.support', module: 'support-v4'
    }

    //Retrofit
    implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"

    //OkHttp Interceptor
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'

    //RxJava
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.1'

    implementation "com.github.bumptech.glide:glide:$glideVersion"
}
-keep class com.support.** { *; }

#Retrofit Start
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on RoboVM on iOS. Will not be used at runtime.
-dontnote retrofit2.Platform$IOS$MainThreadExecutor
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
#if using @Header or @Query
-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}

#GSON
-keep class com.google.gson.** { *; }
-keep class com.google.inject.** { *; }
-keep class org.apache.http.** { *; }
-keep class javax.inject.** { *; }
-keep class retrofit.** { *; }
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }
-keepclassmembernames interface * {
    @retrofit.http.* <methods>;
}
-keep interface retrofit.** { *;}
-keep interface com.squareup.** { *; }
-dontwarn rx.**
-dontwarn retrofit.**

#retrofit models
-keep class com.google.gson.examples.android.model.** { *; }
-keep class com.support.retrofit.model.** { *; }

-keepattributes InnerClasses
-keepattributes Deprecated
-keepattributes EnclosingMethod
-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions
#Retrofit End

-keep public class * extends java.lang.Exception

#Fabric
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**

#Glide
-dontwarn java.nio.file.**
-dontwarn org.codehaus.mojo.animal_sniffer.**

#Glide Module
-keep class com.bumptech.glide.GeneratedAppGlideModuleImpl
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.AppGlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}
-keep class com.bumptech.glide.integration.okhttp3.OkHttpGlideModule

#Support Library
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }

#DataBinding
-dontwarn android.databinding.**
-keep class android.databinding.** { *; }
-keep class <com.support>.databinding.** {
    <fields>;
    <methods>;
}
支持模块proguard:

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta6'
        classpath 'com.google.gms:google-services:3.1.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
        google()
    }
}

project.ext {
    APPLICATION_ID = "com.packagename"
    BUILD_TOOLS_VERSION = "26.0.1"

    COMPILE_SDK_VERSION = 26
    TARGET_SDK_VERSION = 26
    MIN_SDK_VERSION = 19

    VERSION_CODE = 1
    VERSION_NAME = "1.0"

    SUPPORT_LIB_VERSION = "26.1.0"
    RETROFIT_VERSION = "2.3.0"
    GOOGLE_VERSION = "11.2.2"
    GLIDE_VERSION = "3.7.0"
    DATA_BINDING_VERSION = "1.3.3"

    MINIFY_ENABLE = false
    SHRINK_RESOURCES = false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.android.library'

android {
    compileSdkVersion COMPILE_SDK_VERSION
    buildToolsVersion BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion MIN_SDK_VERSION
        targetSdkVersion TARGET_SDK_VERSION

        versionCode VERSION_CODE
        versionName VERSION_NAME
    }
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }
    dataBinding {
        enabled = true
    }
    buildTypes {
        release {
            minifyEnabled MINIFY_ENABLE
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
def supportLibVersion = SUPPORT_LIB_VERSION
def retrofitVersion = RETROFIT_VERSION
def googleVersion = GOOGLE_VERSION
def glideVersion = GLIDE_VERSION
def dataBindingVersion = DATA_BINDING_VERSION
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:appcompat-v7:$supportLibVersion"
    implementation "com.android.support:design:$supportLibVersion"

    implementation "com.android.databinding:library:$dataBindingVersion"
    implementation "com.android.databinding:adapters:$dataBindingVersion"

    implementation("com.google.firebase:firebase-messaging:$googleVersion") {
        exclude group: 'com.android.support', module: 'support-v4'
    }

    //Retrofit
    implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"

    //OkHttp Interceptor
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'

    //RxJava
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.1'

    implementation "com.github.bumptech.glide:glide:$glideVersion"
}
apply plugin: 'com.android.library'

android {
    compileSdkVersion COMPILE_SDK_VERSION
    buildToolsVersion BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion MIN_SDK_VERSION
        targetSdkVersion TARGET_SDK_VERSION

        versionCode VERSION_CODE
        versionName VERSION_NAME
    }
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }
    dataBinding {
        enabled = true
    }
    buildTypes {
        release {
            minifyEnabled MINIFY_ENABLE
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
def supportLibVersion = SUPPORT_LIB_VERSION
def retrofitVersion = RETROFIT_VERSION
def googleVersion = GOOGLE_VERSION
def glideVersion = GLIDE_VERSION
def dataBindingVersion = DATA_BINDING_VERSION
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:appcompat-v7:$supportLibVersion"
    implementation "com.android.support:design:$supportLibVersion"

    implementation "com.android.databinding:library:$dataBindingVersion"
    implementation "com.android.databinding:adapters:$dataBindingVersion"

    implementation("com.google.firebase:firebase-messaging:$googleVersion") {
        exclude group: 'com.android.support', module: 'support-v4'
    }

    //Retrofit
    implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
    implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"

    //OkHttp Interceptor
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'

    //RxJava
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.1'

    implementation "com.github.bumptech.glide:glide:$glideVersion"
}
-keep class com.support.** { *; }

#Retrofit Start
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on RoboVM on iOS. Will not be used at runtime.
-dontnote retrofit2.Platform$IOS$MainThreadExecutor
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
#if using @Header or @Query
-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}

#GSON
-keep class com.google.gson.** { *; }
-keep class com.google.inject.** { *; }
-keep class org.apache.http.** { *; }
-keep class javax.inject.** { *; }
-keep class retrofit.** { *; }
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }
-keepclassmembernames interface * {
    @retrofit.http.* <methods>;
}
-keep interface retrofit.** { *;}
-keep interface com.squareup.** { *; }
-dontwarn rx.**
-dontwarn retrofit.**

#retrofit models
-keep class com.google.gson.examples.android.model.** { *; }
-keep class com.support.retrofit.model.** { *; }

-keepattributes InnerClasses
-keepattributes Deprecated
-keepattributes EnclosingMethod
-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions
#Retrofit End

-keep public class * extends java.lang.Exception

#Fabric
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**

#Glide
-dontwarn java.nio.file.**
-dontwarn org.codehaus.mojo.animal_sniffer.**

#Glide Module
-keep class com.bumptech.glide.GeneratedAppGlideModuleImpl
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.AppGlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}
-keep class com.bumptech.glide.integration.okhttp3.OkHttpGlideModule

#Support Library
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }

#DataBinding
-dontwarn android.databinding.**
-keep class android.databinding.** { *; }
-keep class <com.support>.databinding.** {
    <fields>;
    <methods>;
}
-保留类com.support.*{*;}
#改造启动
#平台对Android上不存在的类型调用Class.forName以确定平台。
-dontnote 2.站台
#在iOS上的RoboVM上运行时使用的平台。将不会在运行时使用。
-dontnote 2.平台$IOS$MainThreadExecutor
#在Java 8虚拟机上运行时使用的平台。将不会在运行时使用。
-dontwarn 2.Platform$Java8
#如果使用@Header或@Query
-keepclassswithmembers类*{
@2.http.*;
}
#格森
-保持类com.google.gson.*{*;}
-保持类com.google.inject.*{*;}
-保持类org.apache.http.*{*;}
-保持类javax.inject.*{*;}
-保持类更新。**{*;}
-保持类sun.misc.Unsafe{*;}
-保持类com.google.gson.stream.*{*;}
-keepclassmembernames接口*{
@http.*;
}
-保持界面更新。**{*;}
-保持接口com.squareup.*{*;}
-dontwarn rx**
-dontwarn改装**
#改装模型
-保持类com.google.gson.examples.android.model.*{*;}
-保持类com.support.reformation.model.*{*;}
-keepattributes内部类
-不推荐使用keepattributes
-keepattributes封闭方法
-keepattributes*注释*
-keepattributes源文件,LineNumberTable
#保留泛型类型信息以供转换器和适配器反射使用。
-保留署名
#保留声明的已检查异常以供代理实例使用。
-保留特例
#改装端
-keep public class*扩展java.lang.Exception
#织物
-保持类com.crashlytics.*{*;}
-dontwarn com.crashlytics**
#滑翔
-dontwarn java.nio.file**
-dontwarn org.codehaus.mojo.animal_sniffer**
#滑动模块
-保持类com.bumptech.glide.GeneratedAppGlideModuleImpl
-keep public类*实现com.bumptech.glide.module.GlideModule
-保持公共类*扩展com.bumptech.glide.AppGlideModule
-保持公共枚举com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$**{
**[]美元价值;
公众*;
}
-保留com.bumptech.glide.integration.okhttp3.OkHttpGlideModule类
#支持库
-keep类android.support.v7.*{*;}
-保留android.support.v7.*{*;}
#数据绑定
-dontwarn android.databinding**
-保持类android.databinding.*{*;}
-继续上课。数据绑定。**{
;
;
}

请不要不假思索地否决投票,添加一条评论,说明你为什么要这样做。这些是唯一的错误吗?一般来说,使用数据绑定时,实际错误在最底层。滚动到错误的底部并在此处发布。此外,您不需要在gradle中添加任何依赖项来进行数据绑定。启用它就足够了。@sam_0829是的,我知道,底部没有错误。gradle就是找不到数据绑定包。首先我没有添加依赖项,但在某个地方,他们建议为新的studio添加依赖项。我也有这个问题,无法解决。考虑回到2.3不知道如何,但这已经解决了Android Studio 3 BETA7更新。但是出现了一个新的错误,这需要一个新的问题,所以不能把它放在这里。请不要不假思索地否决投票,添加一条评论,说明你为什么要这样做。这些是唯一的错误吗?一般来说,使用数据绑定时,实际错误在最底层。滚动到错误的底部并在此处发布。此外,您不需要在gradle中添加任何依赖项来进行数据绑定。启用它就足够了。@sam_0829是的,我知道,底部没有错误。gradle就是找不到数据绑定包。首先我没有添加依赖项,但在某个地方,他们建议为新的studio添加依赖项。我也有这个问题,无法解决。考虑回到2.3不知道如何,但这已经解决了Android Studio 3 BETA7更新。但是一个新的错误来了,这需要一个新的问题,所以不能把它放在这里