how to build an apk file with react-native - android

The docs at https://facebook.github.io/react-native/docs/running-on-device.html make no mention of installing the android sdk. It simply states I should get the adb which I got from developer.android.com/studio/releases/platform-tools.html. now when I try this:
C:\Users\username\Documents\host\Node\worship_app>adb install com.app_name PACKAGE
I get the error "adb: usage: need APK file on command line". So I try the react native route instead with
react-native start
which outputs one message forever: "Loading dependency graph, done."
So I go to another cli window and enter
react-native run-android
After saving the file local.properties in the android subfolder. That's when I get the error " The SDK directory 'C:\Users\nmeri17\AppData\Local\Android\sdk' does not exist.", which in all fairness does not exist. I guess it should be there if I've got android sdk installed but since it's not in the docs, I'm guessing there's another way to go about it. I've squandered all my bandwidth on this folder they downloaded when I ran react-native run-android the 1st time; I was redirected to http://services.gradle.org/distributions/. The folder is still there along with the unpacked zip, along with the thousands of dependencies they also downloaded when I ran create-react-native-app AwesomeProject. I realized what was happening to my bandwidth very late and shut it down but most of the files are still there. Can they be of any use to me? I just want to package the snippets from https://reactnavigation.org/docs/intro/quick-start, setup, see what it looks like and start my personal project based on what I've studied. Is there no way to achieve this without installing the gigantic sdk (which i can't even afford)? Many thanks.

Install Android SDK, it is better to install Android studio it will install all required tool, like ADB, google services etc.
then make sure android studio and java is set to environment path.
then setup all keys and run
react-native run-android --variant=release

Related

Update Flutter App on Android with `flutter install`

So I have an App almost finished, which uses a json file located in the documents path of my android device (using the path_provide package). I know that this file will get deleted as soon as I uninstall the app on my phone. For installing the app onto my phone I want to use the command line flutter install (I'm on Windows). So if I add more features to my app and flutter install again on my android, will it update the device leaving the documents directory just as it is or will it delete that and completely reinstall the app?
I don't think that it's going to delete the app and the file.
I found a solution: If you don't already have it installed, then install ADB and on Windows you then must add the folder with ADB to your Path environment variable, so you can easily access it through cmd on Windows (I don't really know about the other platforms). Then you have to create your APK (for example with flutter build apk --split-per-abi) and then run adb install /path/to/your/apk/file.apk.
Source: mannprerak2's comment on this Github issue https://github.com/flutter/flutter/issues/40560

Initializing Gradle is taking forever on android studio for Flutter project

I'm trying to run a hello world flutter app for the first time on my device, but when I hit run on android studio, it shows initilizing gradle, and it stays like that for more than 20 minutes with no logging or error, I have an intel i5 as a CPU and I'm running it on Linux (dual boot, my download speed is quite slow (200 kb/s average download rate), in case this help
I installed the Flutter SDK and when I try adb devices on my machine it shows my device connected .
So why it's taking that time to run ? (until now it didn't run yet)
https://github.com/flutter/flutter/issues/15106
Please note riftninja's answer.
I look at this directory: C:\Users\myname.gradle\wrapper\dists
Yes, the gradle file is really big: 87M. You have to wait for a long time.
After this will be "Resolving dependencies....", which also slowly.
But finally it succeed.
I've faced the same problem, and my internet is currently very slow, so I solved it by changing the gradle in flutter project to an already downloaded one. Just follow these steps:
Go to C:\Users\YOUR_USER_NAME\.gradle\wrapper\dists
You should find one or more folders with the name of the distribution (for example with the name "gradle-4.6-all" if you were developing in Android Studio previously), choose one of these folders (make sure it is not empty) and copy its name.
Open Android Studio project explorer, and locate android\gradle\wrapper\gradle-wrapper.properties
You will find a line like this:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
Change gradle-5.4.1-all with the folder name you copied in step 2.
Run your app, and hopefully it works this time.
When running flutter project first time even correct configuration it takes very long time.
That is because of downloading gradel and dependencies for particular version.If you ar noob Wait it to complete automatically till all files get downloaded. By using command:
flutter run <project-name> -v you can see whats happening in background.
To Manually downloading gradle zip and put to suitable directory. Go in Project Dir:
/android/gradle/wrapper/gradle-wrapper.properties and click on url and download it.
After Downloading it visit to :/Users//.gradle/wrapper/dists/gradle-4.10.2-all/9fahxiiecdb76a5g3aw9oi8rv your version path may vary
and paste downloaded zip inside it.
For Dependencies to download you need to wait depending on Internet speed.
It is one time process until next updated version and dependencies come UP.
Providing an active internet connection worked for me.
To build gradle offline,
For Windows,
Go to File -> Settings.
And open the 'Build,Execution,Deployment'. Then open the
Build Tools -> Gradle
Then check the box -> Offline work below.
Click the OK button.
For Mac OS,
go to Android Studio -> Preferences, and the rest is the same.
Goto Android Studio - File - Other Setting - Default Project Structure
Uncheck use Embeded JDk
Below, set your JDK path.
Found in Program files - Java - Jdk.
try to making use of flutter run -v which will basically giving the info which is running in background.
The problem is that Gardle is downloading dependencies and not using any way to show progress(This is NOT good for UX), so it is better to run gradlew.bat in the terminal and things will become more clear, like this:
Now it is much better, You can have a cup of coffee while watching it ;)

Unable to Build and Run Unity VR project for Daydream on phone and having hard time debugging the application

Although I’m able to run the apk on phone, but whenever I try to build and run my project directly from Unity on phone, it doesn’t work. This is the error message it shows:
On checking the console, these are the messages it shows:
But I'm pretty sure my path is correct, I checked it multiple times. Also, the APKs are building and working fine. Let me know how can I Build and Run from Unity as I'm not able to debug the applications.
This seems to be a known issue that is solved by downgrading the Android SDK tools to an older version as reported here.
I am just going to re-narrate the steps in the link I shared above for convenience as follows:
Go to Android Studio website.
Scroll down to the end of the page and download the command line tools from the section titled as "Get just the command line tools"
In your computer, go to $AndroidSDKHome$ and rename the tools folder to tools.bak
Extract the contents of zip file that you downloaded to the $AndroidSDKHome$. This basically will replace your SDK tools folder with a downgraded version.

Android: Install released version of app to device from Eclipse

When I want to compile a released version of my app, I sign it and rename the apk file to include a version number in the filename. To launch the app on my device I use adb. Is there a way this can be done in Eclipse?
Another related issue: If I press Run (Ctrl-F11), Eclipse will compile my apk and run it on the device. If my project is called "My App", the file "My App.apk" gets generated. It would be nice if I could get Eclipse to generate a filename that has the same filename as my released version and then maybe Eclipse would also install it with the Run command. Is this possible?
You could achieve all that is mentioned in your question using Ant. You can also run an Ant command from Eclipse.
The following resources would be helpful:
Using Ant to automate building Android applications
Building and running from the command line
This not currently customizable in Eclipse. If you need to automate it, use Ant. You can then start Ant tasks from Eclipse as needed.
A suggestion to make the command line option easier...
Create a top level directory. Copy adb.exe, AdbWinApi.dll and AdbWinUsbApi.dll into this, plus .apk. Then you can do this...
C:\Users\your_username>CD top
C:\Users\your_username\top>adb -d install yourapp.apk

Android: NDK setup in windows

I've been planned to develop an Augmented_Reality(AR) application in an android. So I've gone through various of contribution installing a libraries in eclipse(IDE) like artool,qcar sdk and so on, then I've found that NDK installation should be made before getting into artool kit or qcar sdk So I started to install NDK and progressed as they said in below link:
http://mindtherobot.com/blog/452/android-beginners-ndk-setup-step-by-step/
after doing 'Cygwin' installation they wrote to write 'make -v' in console. Hhen I did I got 'GNU make 3.82.90' but theirs is 'GNU make3.81' as:
where it wasn't as same mine. I know that am using updated cygwin but my problem is I can't able to get .so file as they mentioned accordingly in eclipse. So could you tell me, where I made junk and how can I recover to run AR application in eclipse. Thank you!
actually if you are using window then you do not need to install cygwin. you can also run your project with cmd prompt with following command
start>cmd>cd C:\demoworkspace\testingndk>enter
in Command prompt This is my directory where my project is located with project name. after this
run the ndk address like
C:\demoworkspace\testingndk>C:\ndk-path\ndk-build
ndk-path is directory name where your ndk is located. this will automatically pick your jni c file.
for ndk related query please write me at kdeepak5477#gmail.com
When you are installing cygwin (I used a wizard) make sure you open the DEVEL tree and install MAKE (binary is fine, no need for source).
I also get all the GCC and MINGW stuff just in case.
Perhaps uninstall cygwin, and reinstall using the wizard and ensure MAKE is selected from DEVEL tree.

Categories

Resources