相关疑难解决方法(0)

错误:包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万
查看次数

如何在Android Sudio中使用我自己的Android.mk文件

我在Android.mk文件中定义了一些变量(我正在为编译器传递一些标志),但每次构建我的项目时,都会Android.mk被覆盖.我假设这Gradle是负责任的,我应该在那里看?我如何使用自己的Android.mk文件?

背景资料:

Ubuntu64位,Android Studio1.0.1,JDK7.我NDKO-LLVM NDK封装了我的版本,因此正在编辑Android.mk位于app/build/intermediates/ndk/debug(它是Android.mk我项目目录中唯一的文件)的文件,与doc O-LLVM提供示例的位置不同.

此外,没有Application.mk文件,所以我再次假设Gradle负责调用编译器?

任何帮助将不胜感激.

凯尔


更新的信息

build.gradle - (app)

//The following code until the "----" line is the new build.gradle config file
// that disables automatic Android.mk file generation

import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'com.android.application'

android {

    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.md.helloworld"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName …
Run Code Online (Sandbox Code Playgroud)

java-native-interface llvm gradle android-ndk android-studio

19
推荐指数
1
解决办法
3万
查看次数