小编Pav*_*rre的帖子

错误:包com.android.annotations不存在

我有以下课程

import com.android.annotations.NonNullByDefault;

@NonNullByDefault
public final class Log {
    ...
}
Run Code Online (Sandbox Code Playgroud)

这是我的build.gradle文件(省略了一些部分)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '24.0.1'

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 2
        versionName "0.2"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

}

dependencies {    
    compile 'com.android.support:appcompat-v7:25.0.0'
    compile 'com.android.support:support-annotations:25.0.0'
    compile 'com.android.support:design:25.0.0'
}
Run Code Online (Sandbox Code Playgroud)

在Android Studio中,我的课程没有警告

在此处输入图片说明

但是,当我尝试构建和运行我的应用程序时,我从gradle中得到了此错误

Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:assembleDebug]
Warning:[options] bootstrap class path not set in conjunction with -source 1.7
/home/puter/git-repos/TaskManager3/app/src/main/java/com/treemetrics/taskmanager3/util/Log.java
Error:(3, 31) error: package com.android.annotations does not exist …
Run Code Online (Sandbox Code Playgroud)

android gradle android-studio android-gradle-plugin react-native

27
推荐指数
8
解决办法
5万
查看次数