我是android studio的新手。我创建了新的活动,在做了一些更改之后我得到了渲染错误,我在构建gradle时遇到错误,我该如何解决这个问题。
我完成了重建项目并清理了项目但尚未解决我的问题。
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.example.prakash.aclientzregistration"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:design:22.0.1'
}
这是我的事件日志错误状态
Consult IDE log for more details (Help | Show Log)
4:01:04 AM NullPointerException: null
4:03:05 AM Executing tasks: [:app:generateDebugSources, :app:compileDebugSources]
4:03:06 AM Gradle build finished with 1 error(s) in 1s 162ms
4:03:06 AM NullPointerException: null
4:06:20 AM Gradle sync started
4:06:23 AM Gradle sync failed: Cause: failed to find target with hash string 'android-22' in: C:\Users\Prakash\AppData\Local\Android\Sdk
Consult IDE log for more details (Help | Show Log)
4:12:17 AM Gradle sync started
4:11:59 AM EmptyThrowable: Old dir was moved away, but new one failed to be moved into place. Trying to move old one back.
4:12:19 AM Gradle sync failed: Cause: failed to find target with hash string 'android-22' in: C:\Users\Prakash\AppData\Local\Android\Sdk
Consult IDE log for more details (Help | Show Log)
4:12:19 AM NullPointerException: null
4:13:04 AM Gradle sync started
4:13:06 AM Gradle sync failed: Cause: failed to find target with hash string 'android-22' in: C:\Users\Prakash\AppData\Local\Android\Sdk
Consult IDE log for more details (Help | Show Log)
答案 0 :(得分:2)
我认为未安装sdk平台22
试试这个
Goto Tools-> SDK Manager-> Android 5.1.1-> Sdk Platform(22)安装它。
或者尝试像这样改变
compileSdkVersion 23
buildToolsVersion '23.0.1'
答案 1 :(得分:0)
我认为错误在发布代码中
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'