编译此项目时出现 100 多个错误。 我安装了从 android 4.0 到 5.0 版本的 SDK
代码是这样的,所有红色字母都是AS1.0无法识别的库:
这是 gradle 构建消息,总共有 101 个错误:
这是依赖项:
dependencies {
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.turbomanage.basic-http-client:http-client-android:0.89'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'javax.annotation:javax.annotation-api:1.2'
compile 'org.apache.directory.studio:org.apache.commons.lang:2.6'
compile 'org.mockito:mockito-core:1.10.8'
compile 'com.google.dexmaker:dexmaker:1.0'
compile 'com.google.dexmaker:dexmaker-mockito:1.0'
}
问题是,如果我已经安装了 SDK 并包含了依赖项中的所有内容,为什么 gradle 仍然认为它不存在?
最佳答案
看来基本功能(如R)也有问题。您可以使用以下命令检查您的 build.gradle
:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.hellomap"
minSdkVersion 14
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:21.0.0'
compile 'com.google.android.gms:play-services:6.5.+'
compile 'com.jakewharton:butterknife:6.0.0'
}
确保buildToolsVersion
是最新的,并将您的AS更新到1.01
关于java - 构建错误 : package android. 应用程序不存在 - 构建认为 Android SDK 未安装? (安卓工作室1.0),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27537380/