react-native 运行-android --configuration 版本错误
Error with react-native run-android --configuration Release
我运行以下:
$ adb reverse tcp:8081 tcp:8081
$ react-native run-android
--configuration Release
我得到以下回应:
Release JS server already running.
Running adb -s HT68X0201778 reverse tcp:8081 tcp:8081
Generating the bundle for the
release build... Unable to parse cache file. Will clear and continue.
[01/07/2017, 19:52:45] Initializing Packager [01/07/2017,
19:52:45] Building Haste Map [01/07/2017, 19:52:47]
Building Haste Map (2085ms) [01/07/2017, 19:52:47]
Initializing Packager (2360ms) [01/07/2017, 19:52:47]
Transforming files [01/07/2017, 19:52:48] Transforming files
(1530ms)
bundle: start bundle:
finish bundle: Writing bundle output
to: android/app/src/main/assets/index.android.bundle
ENOENT: no such file or directory, open
'android/app/src/main/assets/index.android.bundle'
我也试过 运行将其设置为 sudo,但没有成功。
更新:我在 'android/app/src/main/' 中手动创建了 'assets' 文件夹,并再次 运行 它。这次它走得更远,但仍然失败,原因如下:
FAILURE: Build failed with an exception.
* What went wrong: Task 'installRelease' not found in root project 'AppVendor'. Some candidates are: 'uninstallRelease'.
基于 documentation,"installRelease" gradle 任务仅在 android/app/build.gradle
编辑应用的 gradle 后才可用:
请注意 signingConfigs 和 buildTypes 配置。
android {
...
defaultConfig { ... }
signingConfigs {
release {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
buildTypes {
release {
...
signingConfig signingConfigs.release
}
}
}
我运行以下:
$ adb reverse tcp:8081 tcp:8081 $ react-native run-android --configuration Release
我得到以下回应:
Release JS server already running.
Running adb -s HT68X0201778 reverse tcp:8081 tcp:8081
Generating the bundle for the release build... Unable to parse cache file. Will clear and continue. [01/07/2017, 19:52:45] Initializing Packager [01/07/2017, 19:52:45] Building Haste Map [01/07/2017, 19:52:47]
Building Haste Map (2085ms) [01/07/2017, 19:52:47]
Initializing Packager (2360ms) [01/07/2017, 19:52:47] Transforming files [01/07/2017, 19:52:48] Transforming files (1530ms)bundle: start bundle:
finish bundle: Writing bundle output
to: android/app/src/main/assets/index.android.bundle
ENOENT: no such file or directory, open 'android/app/src/main/assets/index.android.bundle'
我也试过 运行将其设置为 sudo,但没有成功。
更新:我在 'android/app/src/main/' 中手动创建了 'assets' 文件夹,并再次 运行 它。这次它走得更远,但仍然失败,原因如下:
FAILURE: Build failed with an exception.
* What went wrong: Task 'installRelease' not found in root project 'AppVendor'. Some candidates are: 'uninstallRelease'.
基于 documentation,"installRelease" gradle 任务仅在 android/app/build.gradle
编辑应用的 gradle 后才可用:
请注意 signingConfigs 和 buildTypes 配置。
android {
...
defaultConfig { ... }
signingConfigs {
release {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
buildTypes {
release {
...
signingConfig signingConfigs.release
}
}
}