How to build and upload android app
pashute opened this issue · 4 comments
Solved see 2nd comment below
I ran my react-native (non-expo i.e. disconnected) app with react-native run-android
(on my pc) and got an App-Debug.apk I uploaded that and it seems it doesn't work. I get a white screen.
(How can I see the console.log messages or any type of log?)
For loading on HockeyApp, was I supposed to compile the react native app in android studio as a regular app, not a debug one? With expo I knew how to do that. But no expo now. If so, and I must compile, how do I do that? Any pointer?
Your instructions reach that point but don't explain what else I need to do. When I ran the app on my connected device through run-android
I think (but not sure anymore that) it loaded something shown on the hockeyapp dashboard, but not sure what.
I loaded the android device with the link provided, (and I also loaded an IOS device, which I'll soon configure separately).
Any help appreciated.
As a second try: I loaded the myproject/android folder into the Android Studio from the menu with the FILE/OPEN PROJECT . It took a minute or two to load.
I see several "folded" folders in the project manager under Android: app, and one for each of my installed external npms: react-native-hockeyapp, react-native-kontaktio, react-native-simple-compass and react-native-vector-icons and then there are some Gradle Scripts.
I then chose Build APK(s). Two processes started running the second one is indexing for a long time,
and the first one failed with: the project is using an unsupported version of Gradle. Please point to a supported Gradle version in the project's gradle settings.... and there's a list item: downgrade Gradle to version 3.5.
I do not want to do that... Should I? Must I? Am I on the right path?
For some reason I now don't get a white screen anymore but rather a red screen: unable to load script from assets 'index.android.bundle
then a white screen.
I shook the app and reload and now get: Could not connect to development server...
My device is connected to the pc, but I don't see anything in the browser...
Solved!!
-
Create your keystore file. (Save copies and the credentials somewhere safe so that you can retrieve)
-
Copy the keystore file to myproject/android/app
-
Update the gradle properties according to the instructions here
-
Create the release with
gradle
:cd myproject/android
gradlew assembleRelease
My Environment:
OS: Windows 10
Node: 8.11.1
Yarn: 1.7.0
npm: 6.1.0
Watchman: Not Found
Xcode: N/A
Android Studio: Version 3.1.0.0 AI-173.4907809
Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.3 => 0.55.3
Notes:
I put HockeyApp.configure(HOCKEY_APP, true);
instead of in componentWillMount()
into the the constructor of the file with my first screen (by me its AppMain, because there's only an export in App.js) after reading the linter warnings and the web about componentWillMount.
I added new RNHockeyAppPackage(MainApplication.this)
to getPackages()
in MainApplication.java
instead of adding new RNHockeyAppPackage(this)
to the non-existing getPackages()
in MainActivity.java
.
android/app/build.gradle
I added according to the hockeyapp online instructions, in defaultConfig
section under android
manifestPlaceholders = [HOCKEYAPP_APP_ID: "4d90883bb99743b4967fc2de72ef170c"]
and according to the react-native-hockeyapp
instructions in the dependencies
under android
compile project(":react-native-hockeyapp")
and in the android/build.gradle
according to the current hockeyapp instructions (different from yours) under dependencies
I put:
classpath 'net.hockeyapp.android:HockeySDK:5.1.0'
I would like to update the documentation accordingly, if all goes well. So I'm leaving this open for a week or two, to see if I have time. If not I'll just close it and people can read what I did if they wish.
I think I misunderstood a comment on a github issue, thinking it had to do with HockeyApp, but in fact it had to do with the project they were talking about: wireapp. Accordingly I had written (and now erased):
Also you have to downgrade to gradle 1.5 at most.
See here from hockeyapp: Our current build setup will not work unless you have version 1.5.0.
wireapp/wire-android#177
and See here https://discuss.bitrise.io/t/can-not-install-android-app-through-hockey-app/5450
and this to downgrade https://stackoverflow.com/questions/33892760/how-to-downgrade-to-older-version-of-gradle on StackOverflow
-
I deleted everything inside thecaches
folder inc:\users\myusername\.gradle\caches\*.*
-
I deleted everyting inside the.gradle
folder in my project'sandroid
folder:myprojpath\myprojname\android\.gradle\*.*
-
I changed the version listed inandroid\build.gradle
(not android\app\build.gradle), underdependencies
:classpath 'com.android.tools.build:gradle:1.5.0`
and in gradle-wrapper-properties
I changed distributionurl
to:
distributionUrl=https\://services.gradle.org/distributions/gradle-1.5-all.zip
Note: I'm not able to downgrade to 1.5 I had to fix the following and still did not work:
~removed jcenter() in both buildscript
and allprojects
sections in android\build.gradle
file. ~
Instead I put:
// jcenter() // downgraded to gradle 1.5 and this works only for gradle 1.7 and on
maven { url "https://jcenter.bintray.com" } // jcenter() replacement for gradle versions less than 1.7
It then builds and says:
`FAILURE: Build failed with an exception: build file '... build.gradle' line: 1
A problem occured evaluating project ':app'.
Looking at https://services.gradle.org/distributions/ to see the versions.