Android Studio "Invalid hash string" warning in Compile Sdk Version

955 Views Asked by At

I'm very new at Android app development and trying to apply some changes on an existing project. When I try to change the Compile Sdk Version in Project Structure in Android Studio, it displays a red warning (Invalid hash string) on the right side of the chosen Sdk "Vuzix Corporation:Vuzix M300 SDK:23" and doesn't apply the changes. And then I realised the same also happens for "Google Inc.:Google APIs:23".

It's an app built for Vuzix M300 augmented reality glasses and I followed the documentation on their site to update an existing project and install the M300 SDK in Android Studio. First I built the app using the standard Sdk with Compile Sdk Version API 23: Android 6.0 (Marshmallow), as they recommended to do so. Later they want us to change the Compile Sdk Version to Vuzix M300 SDK (API 23) in Project Structure, which didn't work.

apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '28.0.3'

defaultConfig {
    applicationId "de.tum.fml.pbvofflineapp"
    minSdkVersion 15
    targetSdkVersion 15
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
}

I expect that the compileSdkVersion should change but I don't know what it should be for that specific Sdk.

3

There are 3 best solutions below

3
ismail alaoui On BEST ANSWER

your compileSdkVersion , targetSdkVersion and buildToolsVersion should be on the same version level .

also , in the SDK Manager, make sure SDK version is installed.

after that run "invalidate caches/restart" if the problem persist

Edit

if you are using gradle plugin version 3.4.1

This version of the Android plugin requires the following:

SDK Build Tools 28.0.3 or higher.

source

which means you can't use compileSdkVersion 23

1
Lenin On

If you change compileSdkVersion change also targetSdkVersion to the same. It has no sense to target a previous sdk and compile with greater one. Also you should have buildToolsVersion according with compile sdk

0
rigortek001 On

If you not choose your desired Compile Sdk Version as "Vuzix Corporation:Vuzix M300 SDK:23". which will leads to can not find custom add-on sdk class build error.