2017-07-07 82 views
-3

我有這個bulild.gradle安卓:不容正確設置的build.gradle

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 23 
buildToolsVersion "23.0.2" 

defaultConfig { 
    applicationId "my.package" 
    minSdkVersion 15 
    targetSdkVersion 23 
    versionCode 2 
    versionName "2.0" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
} 

repositories { 
mavenCentral() 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
testCompile 'junit:junit:4.12' 
compile 'com.android.support:appcompat-v7:23.1.1' 
compile 'com.android.support:design:23.1.1' 
compile 'me.dm7.barcodescanner:zxing:1.8.4' 
compile 'com.google.firebase:firebase-messaging:9.0.0' 
compile 'com.squareup.okhttp3:okhttp:3.2.0' 
compile files('libs/urlimageviewhelper-1.0.4.jar') 
compile 'com.mcxiaoke.volley:library:1.0.19' 
compile 'com.squareup.picasso:picasso:2.3.2' 
compile 'com.nineoldandroids:library:2.4.0' 
compile 'com.daimajia.slider:library:[email protected]' 
compile 'com.github.ksoichiro:android-observablescrollview:1.6.0' 
compile 'com.makeramen:roundedimageview:2.2.1' 
compile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1' 
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5' 
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5' 
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5' 
compile 'it.sephiroth.android.library.horizontallistview:hlistview:1.2.2' 
compile 'com.facebook.android:facebook-android-sdk:[4,5)' 


} 

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

,我得到這個錯誤。

Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. 

發現我不得不改變的支持Android版本,所以我做到了

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 25 
buildToolsVersion "23.0.2" 

defaultConfig { 
    applicationId "sk.weyou.matej_kosut.sowosk" 
    minSdkVersion 15 
    targetSdkVersion 23 
    versionCode 2 
    versionName "2.0" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
} 

repositories { 
mavenCentral() 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
testCompile 'junit:junit:4.12' 
compile 'com.android.support:appcompat-v7:25.3.1' 
compile 'com.android.support:design:25.3.1' 
compile 'me.dm7.barcodescanner:zxing:1.8.4' 
compile 'com.google.firebase:firebase-messaging:9.0.0' 
compile 'com.squareup.okhttp3:okhttp:3.2.0' 
compile files('libs/urlimageviewhelper-1.0.4.jar') 
compile 'com.mcxiaoke.volley:library:1.0.19' 
compile 'com.squareup.picasso:picasso:2.3.2' 
compile 'com.nineoldandroids:library:2.4.0' 
compile 'com.daimajia.slider:library:[email protected]' 
compile 'com.github.ksoichiro:android-observablescrollview:1.6.0' 
compile 'com.makeramen:roundedimageview:2.2.1' 
compile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1' 
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5' 
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5' 
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5' 
compile 'it.sephiroth.android.library.horizontallistview:hlistview:1.2.2' 
compile 'com.facebook.android:facebook-android-sdk:[4,5)' 


} 

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

,並在線路

使用火力的時候,現在我得到另一個錯誤

FATAL EXCEPTION: main 
                     Process: sk.weyou.matej_kosut.sowosk, PID: 14788 
                     java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.firebase.iid.zzg' (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/sk.weyou.matej_kosut.sowosk-1/base.apk) 
                      at com.google.firebase.iid.zzg.zzeC(Unknown Source) 
                      at com.google.firebase.iid.zzg.<init>(Unknown Source) 
                      at com.google.firebase.iid.zzg.<init>(Unknown Source) 
                      at com.google.firebase.iid.zzd.zzb(Unknown Source) 
                      at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source) 
                      at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source) 
                      at com.google.firebase.messaging.FirebaseMessaging.getInstance(Unknown Source) 
                      at sk.weyou.matej_kosut.sowosk.login_reg.LoginService.onPostExecute(LoginService.java:148) 
                      at sk.weyou.matej_kosut.sowosk.login_reg.LoginService.onPostExecute(LoginService.java:37) 
                      at android.os.AsyncTask.finish(AsyncTask.java:632) 
                      at android.os.AsyncTask.access$600(AsyncTask.java:177) 
                      at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645) 
                      at android.os.Handler.dispatchMessage(Handler.java:111) 
                      at android.os.Looper.loop(Looper.java:194) 
                      at android.app.ActivityThread.main(ActivityThread.java:5550) 
                      at java.lang.reflect.Method.invoke(Native Method) 
                      at java.lang.reflect.Method.invoke(Method.java:372) 
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:955) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750) 

FirebaseMessaging.getInstance().subscribeToTopic(" "); 

我可能想要這些舊版本。

或者我應該改變什麼?我試圖從星期一算起。

回答

0

你編譯SDK版本必須支持庫匹配,試試這個 變化

buildToolsVersion "23.0.2" 

buildToolsVersion "25.0.2"