我正在尝试根据反应原生代码推送文档的
this section来配置我的RN android项目
我的build.gradle文件具有以下配置:
buildTypes { debug { } releaseStaging { buildConfigField "String","CODEPUSH_KEY",CODEPUSH_KEY_STAGING } release { buildConfigField "String",CODEPUSH_KEY_PRODUCTION minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"),"proguard-rules.pro" signingConfig signingConfigs.release } }
但是当我运行时:react-native run-android –variant releaseStaging
我收到错误:在根项目’MyAppName’中找不到任务’installReleaseStagingDebug’.
还试过运行react-native run-android -configuration releaseStaging
这给了我一个稍好的错误:
Task 'installReleaseStaging' not found in root project 'MyAppName'. Some candidates are: 'uninstallReleaseStaging'.
知道我错过了什么吗?
谢谢!
乌里
您必须将signingConfig添加到releaseStaging.
releaseStaging { signingConfig signingConfigs.release buildConfigField "String",CODEPUSH_KEY_STAGING }
然后,您可以将其安装到您的设备上.我有反应原生版本0.38,所以我用react-native run-android –variant = releaseStaging安装它,但这可能与其他反应原生版本不同.如果您有更新版本的react-native,则可以执行react-native run-android -configuration = releaseStaging.