简体   繁体   English

编译 Sdk 版本中的 Android Studio“无效哈希字符串”警告

[英]Android Studio "Invalid hash string" warning in Compile Sdk Version

I'm very new at Android app development and trying to apply some changes on an existing project.我对 Android 应用程序开发非常陌生,并尝试对现有项目应用一些更改。 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.当我尝试在 Android Studio 的项目结构中更改编译 Sdk 版本时,它在所选 Sdk 的右侧显示红色警告(无效的哈希字符串)“Vuzix Corporation:Vuzix M300 SDK:23”并且不应用变化。 And then I realised the same also happens for "Google Inc.:Google APIs:23".然后我意识到“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.这是一个为 Vuzix M300 增强现实眼镜构建的应用程序,我按照他们网站上的文档更新现有项目并在 Android Studio 中安装 M300 SDK。 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.首先,我使用标准 Sdk 和 Compile Sdk Version API 23: Android 6.0 (Marshmallow) 构建了应用程序,因为他们建议这样做。 Later they want us to change the Compile Sdk Version to Vuzix M300 SDK (API 23) in Project Structure, which didn't work.后来他们想让我们在项目结构中将编译 Sdk 版本更改为 Vuzix M300 SDK (API 23),但没有成功。

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.我希望compileSdkVersion应该更改,但我不知道该特定 Sdk 应该是什么。

your compileSdkVersion , targetSdkVersion and buildToolsVersion should be on the same version level .您的compileSdkVersiontargetSdkVersionbuildToolsVersion应该在同一版本级别。

also , in the SDK Manager, make sure SDK version is installed.另外,在 SDK Manager 中,确保安装了 SDK 版本。

after that run "invalidate caches/restart" if the problem persist之后,如果问题仍然存在,请运行“使缓存无效/重新启动”

Edit编辑

if you are using gradle plugin version 3.4.1如果您使用的是 gradle 插件版本 3.4.1

This version of the Android plugin requires the following:此版本的 Android 插件需要以下内容:

SDK Build Tools 28.0.3 or higher. SDK 构建工具 28.0.3 或更高版本。

source 来源

which means you can't use compileSdkVersion 23这意味着你不能使用compileSdkVersion 23

If you change compileSdkVersion change also targetSdkVersion to the same.如果您更改 compileSdkVersion 也将 targetSdkVersion 更改为相同。 It has no sense to target a previous sdk and compile with greater one.以以前的 sdk 为目标并使用更大的 sdk 进行编译是没有意义的。 Also you should have buildToolsVersion according with compile sdk你也应该有符合 compile sdk 的 buildToolsVersion

If you not choose your desired Compile Sdk Version as "Vuzix Corporation:Vuzix M300 SDK:23".如果您没有选择所需的编译 Sdk 版本为“Vuzix Corporation:Vuzix M300 SDK:23”。 which will leads to can not find custom add-on sdk class build error.这将导致找不到自定义附加 sdk 类构建错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM