2017-04-27 40 views
1

我使用錯誤:2.3.1

import com.android.annotations.Nullable; 

它被編譯和應用程序是在

  • 的Android工作室運行包com.android.annotations不會在Android Studio中存在2.3
  • gradle版本2.14.1和
  • android插件版本 2.2.3。

但更新到

  • 的Android 2.3.1工作室
  • gradle這個版本3.3和
  • Android插件版本2.3.1

後停止編譯。我已搜查喜歡this其他一些SOF的問題,但他們建議使用不同的包裝

import android.support.annotation.Nullable; 

我想知道這是強制使用的支持LIB包。如果是,它是如何與其他進口運行?

我的應用程序的build.gradle

// 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.3.1' 
//  classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' 
     classpath "io.realm:realm-gradle-plugin:3.0.0" 
     // 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 
} 

模塊的build.gradle

apply plugin: 'com.android.application' 
//apply plugin: 'com.neenbedankt.android-apt' 
apply plugin: 'realm-android' 


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' 
    }) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:support-annotations:25.1.0' 
    compile 'com.android.support:multidex:1.0.1' 
    compile 'com.android.support:appcompat-v7:25.1.0' 
    compile 'com.google.android.gms:play-services-maps:10.0.1' 
    compile 'com.github.PhilJay:MPAndroidChart:v2.2.5' 
    compile 'com.android.support:design:25.1.0' 
    compile 'com.pkmmte.view:circularimageview:1.1' 
    compile 'com.android.support:cardview-v7:25.1.0' 
    compile 'com.android.support:recyclerview-v7:25.1.0' 
    compile 'com.android.support:support-v4:25.1.0' 
    compile 'com.github.aakira:expandable-layout:[email protected]' 
    compile 'com.google.maps.android:android-maps-utils:0.4.4' 
    // retrofit library for networking calls 
    compile 'com.squareup.retrofit2:retrofit:2.2.0' 
    // gson adapter for rxjava 
    compile 'com.squareup.retrofit2:converter-gson:2.2.0' 
    // rxjava adapter for retrofit 
    compile 'com.squareup.retrofit2:adapter-rxjava2:2.2.0' 
    // rxandroid library 
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1' 
    // rxjava library 
    compile 'io.reactivex.rxjava2:rxjava:2.0.6' 
    // sugar ORM library 
    compile 'com.github.satyan:sugar:1.5' 
    // compile 'com.squareup.okhttp3:okhttp:3.5.0' 
    compile 'com.jakewharton:butterknife:8.5.1' 
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1' 
    // library for implementing Parcelable interface 
    compile 'org.parceler:parceler-api:1.1.6' 
    annotationProcessor 'org.parceler:parceler:1.1.6' 
    compile 'com.github.eralpyucel:CircleProgressView:v1.1' 
    // library for intercepting OKHttp3 api calls 
    compile 'com.squareup.okhttp3:logging-interceptor:3.4.1' 
    compile 'me.relex:circleindicator:[email protected]' 
    // releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5' 
    compile 'com.squareup.picasso:picasso:2.5.2' 
    // library to show view transition in pre-lollipop android version 
    compile 'com.kogitune:pre-lollipop-activity-transition:1.3.3' 
    // library for getting user location updates 
    compile 'com.github.delight-im:Android-SimpleLocation:v1.0.1' 
    // library for date time picker 
    compile 'com.wdullaer:materialdatetimepicker:3.1.3' 
    // for showing memory leaks 
    debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5' 
    // for viewing database in chrome 
    debugCompile 'com.facebook.stetho:stetho:1.5.0' 
    // n/w interceptor will show request url, header, body and response 
    debugCompile 'com.facebook.stetho:stetho-okhttp3:1.5.0' 
    debugCompile 'com.facebook.stetho:stetho-js-rhino:1.5.0' 
    // realm support for stetho 
    debugCompile 'com.uphyca:stetho_realm:2.0.0' 
} 

正如你可以看到的build.gradle我評論過

//apply plugin: 'com.neenbedankt.android-apt' 

註解插件,我是在Android studio 2.3中使用和更新後,我已經刪除它,因爲註釋處理器是由Andr提供的oid工作室本身。

所以,我想知道爲什麼機器人工作室是無法找到

進口android.support.annotation.Nullable;

更新後這個註解類出現在我之前使用的插件中?

+0

你解決了嗎?我有同樣的問題。 – qbait

+0

@qbait我只是改變所有的進口報表。無法找到解決方案 – prateek

+0

@ prateek你解決了嗎?我在加那利8同樣的問題。https://stackoverflow.com/questions/45204273/runtime-errors-with-library-package-android-studio-canary-6-canary-7 – DroidLearner

回答

0

請在您的應用程序的build.gradle改變你的gradle這個版本classpath 'com.android.tools.build:gradle:2.3.1',然後嘗試

+0

它已經在那裏看到我的applcation構建.gradle文件 – prateek

2

我也有這個問題,我有

import com.android.annotations.NonNull; 

,但不會找到包。

所以我評論該行並再次導入,將其改爲:

import android.support.annotation.NonNull; 

至極終於奏效。

相關問題