Prakash Samy
Prakash Samy

Reputation: 91

Android Studio gradle build error

I am new for android studio. I created new activity i got a rendering error after make few changes i got an error in building gradle, how can i solve this.

I done rebuild project and clean project open but not yet solved my problems.

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'
    }

this my event log error status

      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)

Upvotes: 0

Views: 1343

Answers (2)

akhil Rao
akhil Rao

Reputation: 1169

I think the sdk platform 22 is not installed

Try this

Goto Tools->SDK Manager->Android 5.1.1->Sdk Platform(22) install it.

Or try to change like this

    compileSdkVersion 23
    buildToolsVersion '23.0.1'

Upvotes: 2

user5383419
user5383419

Reputation:

i think error is in release code

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'

Upvotes: 0

Related Questions