Mar*_*lic 10 java sdk android gradle
Failed to set up SDK: Error:Module 'app': platform 'Google Inc.:Google APIs:21' not found.
Run Code Online (Sandbox Code Playgroud)
完全失去了为什么这不起作用.尝试将我的SDK更新到23,但意识到我还没准备好处理所有新的弃用等,所以我在Mercurial上恢复了旧版本.我完全没有其他任何东西,而且回归应该已经解决了所有问题.不幸的是,我无法连接我的应用程序并构建它.我甚至从头开始重新安装Android Studio,但我仍然收到相同的警告,我的应用程序根本无法构建.什么可能出错?
这是我的构建gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:21'
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "com.elgami.customizer"
minSdkVersion 14
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
//runProguard false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.ogaclejapan.smarttablayout:library:1.5.0@aar'
compile 'com.github.antonyt:InfiniteViewPager:v1.0.0'
compile 'com.android.support:appcompat-v7:22.2.0'
// recyclerview
compile 'com.android.support:recyclerview-v7:23.1.1'
// google analytics
compile 'com.google.android.gms:play-services-analytics:8.3.0'
// pager sliding strip
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
// http library (for using beanstream REST)
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
// amaazon S3 uploads
compile 'com.amazonaws:aws-android-sdk-s3:2.1.+'
// paypal purchasing
compile files('libs/PayPalAndroidSDK-2.7.1.jar')
// Module dependency on ParseLoginUI library sources
compile project(':ParseLoginUI')
// Parse libs
compile files('libs/ParseCrashReporting-1.9.2.jar')
compile files('libs/Parse-1.9.1.jar')
compile files('libs/ParseFacebookUtilsV4-1.9.1.jar')
// android support v4
compile files('libs/android-support-v4.jar')
// facebook SDK
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
//butterknife
compile 'com.jakewharton:butterknife:6.1.0'
// Subsampling-scale-image-view (for templating)
//compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.1.4'
compile files('libs/AppRater.jar')
}
Run Code Online (Sandbox Code Playgroud)
Int*_*iya 10
你可以用compileSdkVersion 21
而不是用你的.
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "com.elgami.customizer"
minSdkVersion 14
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
//runProguard false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
Run Code Online (Sandbox Code Playgroud)
该建议更换(目前公认的)的答案Google Inc.:Google APIs:21
用21
,如果你有一些遗留的应用程序仍然使用谷歌地图V1(例如)是不适合的.
如果您处于这种情况,您真的需要编译Google Inc.:Google APIs:21
或23等...
这里的解决方案是
步骤1
打开旧的SDK管理器界面,单击Android Studio SDK Manager下方的Launch Standalone SDK Manager链接,或者${ANDROID_SDK_DIR}/tools/android sdk
从命令行执行以直接打开它.
然后找到您需要的SDK版本的Google API并安装它:
由于某种原因,该软件包在Android Studio中被隐藏,我希望Google会在某些时候将其删除.目前SDK 24 one(Marshmallow)可用但25(Nougat)不可用,他们可能会在将来添加它.我们将不得不拭目以待.
如果你处于这种情况并且谷歌决定停止提供它,你将不得不使用地图v2重写功能.
第2步
即使在执行此操作并清理+ gradle resync之后,您也会从Android Studio中收到此错误:
Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.
Run Code Online (Sandbox Code Playgroud)
但是如果你尝试从命令行(./gradlew assembleDebug
)执行它,它将编译.
原因显然与Android Studio嵌入式Java JRE有关.要在Android Studio中编译,请从Android Studio打开项目结构,并为系统上安装的JDK提供自定义路径(必须在计算机上安装OpenJDK/OracleJDK).
注意:可能需要导航到该位置,而不是复制Android Studio的路径以进行更改.不要选择jre
目录,选择JDK(包含的文件夹jre
).
警告:此更改不是特定于项目的,但将应用于Android Studio本身并用于任何其他项目.
归档时间: |
|
查看次数: |
20022 次 |
最近记录: |