jaggerwang / zqc-app-demo

在球场移动应用开源版,可用作React Native移动应用开发的参考。
http://study.163.com/course/courseMain.htm?courseId=1003433016
MIT License
208 stars 60 forks source link

running "react-native run-android" failed #5

Closed jinqiupeter closed 7 years ago

jinqiupeter commented 7 years ago

Just followed the instructions but failed, could you please take a look? thanks! here is the output:

JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug...
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html.

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/peter/dev/zqc-app-demo/android/app/build.gradle' line: 102

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not get unknown property 'ZAIQIUCHANG_RELEASE_STORE_FILE' for SigningConfig_Decorated{name=release, storeFile=null, storePassword=null, keyAlias=null, keyPassword=null, storeType=null, v1SigningEnabled=true, v2SigningEnabled=true} of type com.android.build.gradle.internal.dsl.SigningConfig.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 5.366 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

and the screenshot:

screen shot 2017-02-28 at 1 50 58 am

jaggerwang commented 7 years ago

Please follow this doc Generating Signed APK. You need setting up gradle variables.

ZAIQIUCHANG_RELEASE_STORE_FILE=my-release-key.keystore
ZAIQIUCHANG_RELEASE_KEY_ALIAS=my-key-alias
ZAIQIUCHANG_RELEASE_STORE_PASSWORD=*****
ZAIQIUCHANG_RELEASE_KEY_PASSWORD=*****
jinqiupeter commented 7 years ago

@jaggerwang Thanks for reply. I generated the key file and error was fixed. But I also got another error:

screen shot 2017-03-01 at 12 08 21 am

, which I fixed by changing the method from "protected" to "public":

screen shot 2017-03-01 at 12 09 48 am

Then another error showed up ^_^:

screen shot 2017-03-01 at 12 10 46 am

, to fix this one, I added:

dexOptions {
    javaMaxHeapSize "4g"
    preDexLibraries = false
}

to android/app/build.gradle and finally got everything working!

Maybe we should put what I went through in Known Issues or ReadMe?

Thank you again for sharing this wonderful project, I learned a lot from reading and refactoring your code. To all future visitors, I also recommend the tutorial courses by author @jaggerwang at React Native跨平台移动应用开发 , most of my questions and doubts are cleared from the sessions, especially those regarding caching on the client side.

jaggerwang commented 7 years ago

Thanks for your suggestion. It already added to the known issues.