How do I export my project in Android Studio? - android

I need to export my Android Studio project to an Android phone. I've generated a signed APK already but I don't know what to do after this. What else do I need to do to export my project?

Install it. Look for the apk file in the project folder and transfer it to your phone and click it.
Another way, connect your android phone to your laptop and click on instant Run.

This isn't called exporting, it's called installing.
By default, the APK should be under
app/release/
in your project directory, as app-release.apk.
You can use the Android Studio terminal tab (check the bottom toolbar) to install it directly:
adb install -r app/release/app-release.apk

If you have Android Emulator, then you can directly run and check your app contents.
Or
If you want your app to run on your phone, then go to the app folder of your Android project
Directory : app/release/release.apk
Connect your data cable and move that release.apk in your phone directory and install that apk file in your Android phone.

Related

How to simply install apk in device in Android Studio

My question is when i click on run button it runs gradle command to check change files and build class and then dex to create apk.
If i know there is no change in my files still gradle runs to check.
As i have many libraries attached to my app module to reduce run time. if anyone knows to install apk in device from android studio without running gradle.
Note : I want to install on device which is connected to my system not to emulator,etc.
Note : I want to install from android studio not by using any other software.
One more solution is using terminal to install apk on devices.
Once you have built your APK using the File>Build APK, it shows you the path in which new apk is present.
Just go to the path on terminal like below
generated apk path on my system -$cd /Android_App_Code/UpdatedCodeForCheckOut/Projects/IMS/source/apps/Android/flowtalk/app/build/outputs/apk
and type -$ adb install -r app-debug.apk
this command just installs the build on your connected device.
and now every time when there is no change in code, just run install command on terminal. It's super fast you will see.
You can't skip a Gradle build unless you want a constant APK that has no changes.
Go to File>Build APK. Then, Gradle will build once. After that, a bubble at the top-right corner will appear indicating a successful APK generation.
Click "Show in explorer", copy the generated APK and move it to your connected device. Then, go on your device>Your File Manager>The APK you just moved. Click it and install the application. There you have it.
There is no way for you to run without a Gradle build, and you're not the only one who thinks it is utterly STUPID for a force rebuild every time you want to build an APK or run an app with no changes since the last build.
I use this method to install the generated APK to the device using bash script since I'm working on Linux(didn't try this on windows or os x).
When you run the app in the android studio the run tab will print out the commands which android studio uses to install the app on the device.
I just copy these commands into a file and save it as run.sh
run.sh
#!/bin/sh
adb push /home/gautam/sample/app/build/outputs/apk/debug/app-debug.apk /data/local/tmp/com.example.sample.sample
adb shell pm install -t -r "/data/local/tmp/com.example.sample.sample"
adb shell am start -n "com.example.sample.sample/com.example.sample.sample.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
save the file in you project directory(although you can keep it any where).also add it to you gitignore if you need. Then open you terminal in android studio and run the script file to install the APK.
chmod a+x run.sh
./run.sh
This will install the apk to the connected device. If more then one device are connected the script will throw error in which case you will have to provide the device id refer this.
Hope this helps.
Generate apk (gradle build)
Select generated apk in the project tree
Right-click to .apk -> install APK
via plugin: install apk
Actually you can.
Just create a new Run/Debug configuration (Edit configuration on the drop down list on the left of the "Run" arrow). Then remove "Gradle-aware Make" in the "Before launch" section of your configuration.
To run this configuration you need to have an existing APK generated otherwise it doesn't work, as this new configuration will just install the existing one.)
For people who use Flutter, Do as the following instruction.
Connect your Android device to your computer with a USB cable.
Enter cd where is your application directory.
Run flutter install.
Flutter: Install an APK on a device
There's a much easier way now.
Windows:
To install an App that you you have the APK file for:
Start the Device Emulator.
Drag the .apk file onto the emulator.
EOL
In Android Studio 2.2 there is a new property "build cache". To install it you open gradle.properties file of your project and add there:
android.enableBuildCache=true
like described here
And if you have no changes, your gradle will build in few seconds.
EDIT: Description of Build Cache from here:
Android Studio 2.2 Beta 3 introduces a new build cache feature that can speed up build times (including full builds, incremental builds, and instant run) by storing and reusing files/directories that were created in previous builds of the same or different Android project.
In other words, Build Cache reuses unchanged files rather then rebuild them.
If you haven't changed anything on your files and it's not the first time you run the app on the device, you can navigate to the app on your device and open it from there. If your device is connected to your computer, you would still be able to access logcat of the app.
If the modifications you've done is on an existing file, like the layout or .java file or any file that already exist, you can simply click on the apply changes button which is besides the run button as shown:
The apply changes button to the right of the run button in android studio
works with android 3.0.1 and later.
If you've added any new resources or created a new java file or new activity, the you must run from scratch to rebuild the hgradle.
Just create new configuration "install" with Launch Options -> Launch: Nothing

Android, Run application without emulator or any device

I want to test my app and I don't want to run emulator, unfortunately Windows 8.1 doesn't recognize my Samsung device. I want eclipse just to build the app's APK and I'll test the app by myself by using the file that is created in bin directory.
when you don't have any compatible emulator or any connected device, eclipse asks for running new emulator, I don't want see this dialog !
First: Consider fixing the problem with Windows recognizing your phone.
Second: You can use the Android SDK to make an APK - you can then transfer it to the device the way you prefer (download from webserver, e-mail eg.). Alternatively you can use Google Play + the alpha/beta testing feature to roll out tests to your device (+ any other device you want to test on).
In that case, Only Build the project, then in your project directory look for "bin" folder, you will find an APK file of your project there, you can copy that and install it later on your device
Hope this helps
Unfortunately, building the project alone won't create an APK file. You can export your project to get APK file. For exporting, right-click on your project in Eclipse and select Export..., then choose Export Android Application:
Please note that you have to create a key to export your project and sign it. If you want to create an unsigned package (which must be only used for testing purposes), right-click on your project, then from Android Tools select Export Unsigned Application Package:
You can get the application in the bin folder there you can find the apk.
You can build by running the command "ant clean release install" from your application folder.
On ecllipse editor try this:
go to Windows -> Select Preferences
then Android -> Build
Now uncheck "Skip packaging and dexing until export or launch. (Speeds up automatic builds on file save.)"
You may need to restart ecllipse.

How to create a setup of android project which work on android mobile?

I have created a demo android application.I want to create a setup of demo android project which should install on all android device directly without android market to check application working or not just like a window application.
Thank's in advance
If you want to test your application on all devices you only need to copy .apk file present in your bin folder. It is by default signed with your default keystore. If you did not find any .apk file inside your bin folder than you have to clean build your project once and run it once. Framework will generate one .apk file automatically.
Now only you need to deploy your apk to all devices where you want to test or you can run adb command if your device is in debug mode.
adb install "apk path"
Firstly you should export you android project to apk.....by going to Android Tools-> Export Signed Application Package -> then follow on screen instruction
Then you should connect your devices to computer and run the following command from terminal:
adb install "path to apk file"

How to install an apk on the emulator in Android Studio?

How do you install an apk on the emulator in Android Studio from the terminal?
In Eclipse we did
/home/pcname/android-sdks/platform-tools/adb -s emulator-5554 install /home/pcname/Downloads/apkname.apk
Now how about in Android Studio?
Run simulator -> drag and drop yourApp.apk into simulator screen.
Thats all.
No commands.
EDIT: Even though this answer is marked as the correct answer (in 2013), currently, as answered by #user2511630 below, you can drag-n-drop apk files directly into the emulator to install them.
Original Answer:
You can install .apk files to emulator regardless of what you are using (Eclipse or Android Studio)
here's what I always do: (For full beginners)
1- Run the emulator, and wait until it's completely started.
2- Go to your sdk installation folder then go to platform-tools (you should see an executable called adb.exe)
3- create a new file and call it run.bat, edit the file with notepad and write CMD in it and save it.
4- copy your desired apk to the same folder
5- now open run.bat and write adb install "your_apk_file.apk"
6- wait until the installation is complete
7- voila your apk is installed to your emulator.
Note: to re-install the application if it already existe use adb install -r "your_apk_file.apk"
sorry for the detailed instruction as I said for full beginners
Hope this help.
Regards,
Tarek
For those using Mac and you get a command not found error, what you need to do is
type
./adb install "yourapk.apk"
Start your Emulator from Android Studio Tools->Android-> AVD Manager then select an emulator image and start it.
After emulator is started just drag and drop the APK Very simple.
Just drag APK file to android emulator it will install automatically.
In android studio emulator to run an apk file just drag the apk into the emulator.The emulator will install the apk
Much easier is just to start your emulator, then go to sdk/platform-tools and use adb from there to install apk. Like:
adb install xxx.apk
It will install it on running emulator.
Drag and drop apk if the emulator is launched from Android Studio. If the emulator is started from command line, drag and drop doesn't work, but #Tarek K. Ajaj instructions (above) work.
Note: Installed app won't automatically appear on the home screen, it is in the apps container - the dotted grid icon. It can be dragged from there to the home screen.
For Linux: once emulator is running, the following worked for me.
Because I installed the Android SDK on my home directory, I have the following file structure:
home/Android/Sdk/platform-tools/adb
home/AndroidStudioProjects/Metronome.adk
AndroidStudioProjects is a file folder I made for my Android projects. "Metronome.adk" is the file I want to run.
So, using Terminal from the home directory...
./Android/Sdk/platform-tools/adb install ./AndroidStudioProjects/Metronome.adk
Being a Linux novice, I often forget the need to put the "./" in when trying to locate a file or run a command.
After the command achieves "Success", the app is in the Apps area of the emulator and can be run.
When you start Android studio Look for Profile or Debug apk.
After clicking you get the option to browse for the saved apk and you will be able to later run it using emulator
If Android Studio is already open:
Click on File you can find Profile or Debug apk in this menu too
Just download the apk from talkback website
Drag the downloaded apk to the started emulator, Go to settings on emulator > Search for talkback, you will now find it there
1.Install Android studio.
2.Launch AVD Manager
3.Verify environment variable in set properly based on OS(.bash_profile in mac and environment Variable in windows)
4. launch emulator
5. verify via adb devices command.
6.use adb install apkFileName.apk
Upload your apk file on the cloud , then make a direct download link for downloading and then copy that link and paste it on the emulator browser for download it :) ;
In Android Studio: View - Tool Windows - Gradle
In the Gradle tool window navigate to your :app - Tasks - install
and then execute (by double-clicking): any of your install*tasks: e.g. installDebug, installRelease
Note: the apk will also automatically installed when you Run your application

Application not installed in android error

I have made application in Netbeans7.1.2 .
my application working perfectly in emulator which is configured android 2.1 but after copying bin folder in Android device(tablet) that gives error "Application not installed".
what is this problem plz if someone know about this ?
Copying bin/ folder is not sufficient enough to warrant an install.
You can do it this way:
Use the Android's SDK tool called adb to install it directly on to the device. For example, suppose your package-name in your project is called org.foo.bar.app and an apk file is generated and called foobar.apk (This will be found in the bin/) folder typically, or where you specify Eclipse to generate the apk, via from within Eclipse:
Right click on project
Click on Android Tools
Click on Export the unsigned Application Package
OR
Click on Export Signed Application Package.
Then:
Plug in cable to device, and issue the command from within Windows Cmd or Linux Terminal, in this manner, adb install foobar.apk
To uninstall an app from the device, specify the package-name, like this adb uninstall org.foo.bar.app

Categories

Resources