Android Studio “Invalid hash string” warning in Compile Sdk Version

吃可爱长大的小学妹 提交于 2020-01-16 03:39:22

问题


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.


回答1:


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




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/56549372/android-studio-invalid-hash-string-warning-in-compile-sdk-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!