【发布时间】:2016-01-12 12:57:32
【问题描述】:
我已经尝试解决这个奇怪的问题 2 天了,但我根本找不到答案。我在这里查看了各种不同的问题,但这似乎与我遇到的问题略有不同。
当我启动一个新应用程序时,我的 android studio 工作正常,它呈现视图并且没有问题。
当我导入一个应用程序时,我需要处理它突然无法同步 gradle 并说以下内容:
错误:原因:在 E:\Android\sdk 中找不到带有哈希字符串 'android-22' 的目标
我的 Android SDK 是最新的,所有工具都已安装 - 见下图:
这是我到目前为止所做的尝试让这个导入显示,我使用的是 Windows PC
- 卸载 Android Studio 并重新安装 SDK
- 确保已设置 ANDROID_HOME 系统变量和工具和平台路径 - 经测试可以从 CMD 调用“Android”并加载 SDK
- 编辑了 build.Gradle 文件以针对另一个 SDK 版本 - 但它只是说它找不到新的目标版本。
我还可以做一些其他事情来尝试导入此应用吗?据我所知,该应用对其他人来说运行良好......
更新 gradle sn-p
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
packagingOptions {
exclude('META-INF/NOTICE')
}
packagingOptions {
exclude('META-INF/LICENSE')
}
defaultConfig {
applicationId "ru.ifsoft.network"
minSdkVersion 15
targetSdkVersion 22
versionCode 12
versionName '1.5'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.mcxiaoke.volley:library:1.0.18'
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile 'com.android.support:recyclerview-v7:22.2.+'
compile 'com.github.chrisbanes.photoview:library:1.2.3'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.1'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services-ads:7.5.0'
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.android.support:design:22.2.1'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
}
谢谢
【问题讨论】:
-
我已经尝试了所有这些方法,但它不起作用。我已经安装了工具。
-
你能发布你的 build.gradle 或它的片段
-
设置
compile 'com.android.support:recyclerview-v7:22.2.1'避免+ -
您是否安装了Android 5.1.1 (22) SDK Platform,还是只安装了Android 6.0,如截图所示?
标签: android android-studio gradle facebook-android-sdk