2017-04-27 65 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; 

至极终于奏效。