我使用MS CodePush来推送反应本机代码,但日志显示:
[CodePush] 400: An update check must include a deployment key, and provide a semver compliant app version.
我在Activity中提供了部署密钥:
@Override
protected List<ReactPackage> getPackages() {
// 4. Instantiate an instance of the CodePush runtime, using the right deployment key
codePush = new CodePush("g-*********", this, BuildConfig.DEBUG);//staging
return Arrays.<ReactPackage>asList(
new MainReactPackage(), codePush.getReactPackage(), new RNPackage());
}
并在build.gradle中设置versionName:
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion COMPILE_SDK_VERSION as int
buildToolsVersion BUILD_TOOLS_VERSION
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionName "2.1.5"
versionCode 35
applicationId "com.xx"
// Enabling multidex support.
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
buildTypes {
debug {
buildConfigField "boolean", "PRINT_LOG", "true"
buildConfigField "String", "SERVER_TYPE", '"dev"'
#versionNameSuffix "_debug" #[SOLVED]Here is the error goes! remove this line and it works!
signingConfig signingConfigs.release
}
和JS:
componentDidMount() {
// codePush.sync();
codePush.sync({ deploymentKey: "g-******************" });
}
答案 0 :(得分:1)
“2.1.5_debug”不是有效的semver字符串,我们的服务器需要一个有效的semver,例如“2.1.5”。
我在您的Gradle文件中看到您已将其定义为“2.1.5”,“_ debug”来自何处?你有没有在其他地方定义它在“AndroidManifest.xml”文件中?