I'm new to Android Studio and I would like to know the difference between the APK generated using Build -> Build APK(s) and the one using the 'play' button (Ctrl+F5).
The problem is the following: I'm using some native libraries and when debugging with Ctrl+F5 (the play button) I get an UnsatisfiedLinkError because the library is not found. Indeed if I open the APK (Build ->Analyze APK) I see there is no 'lib' folder so no .so lib.
However when I Build -> Build APK(s) and then analyze this new APK I can see the 'lib' folder with all the .so libs. Then if I copy this APK inside my phone and install the app, everything works fine (I use Native Libs Monitor and it recognizes the native libs inside).
Of course I cannot do this everytime so I'm looking for the differences so that I can understand why the libs are not created inside the apk in the fist case.
The simple explanation is that the build .apk makes your project generate all the code into one file (.apk) and then it can be opened and installed on Android.
If run which is like the 'play button' runs your project without you needing to install the .apk file first and of course this makes it easier for you as a developer.
if there is an error problem, you should attach the error message to your question and it is better if you attach it in the form of a screenshot.
Related
i have developed an app from android studio 1.1.0 and. it work fine with my android studio emulator. now how to generate an *.apk file from the project. it was very easy in eclips. apk was automatically generated.
NOTE: i don't have any signature . i want to develop an free app without anyting to buy. example signature,license and all.
Use Grails build.
On the right side of the IDE there is a tab for gradle tasks. Click that, and then you will see the gradle build options. You may have to turn out the triangle to see it, but you will see all sorts of options. Look for "Assemble Release" and double click it. The status of the build will show in the bottom of the IDE.
After you run it, your apk can be found in the build directory below the app.
app/build/
Link for more information:
https://developer.android.com/tools/building/building-studio.html
https://developer.android.com/tools/building/configuring-gradle.html
I would like to see the output folder itself directly in the android studio IDE.
To be clear i want the apk output folder to show up in my IDE so i can see apks as they are built. The folder from the OS explorer shows the apk in Foo/*/build/outputs/apk/ .
However, i want this same folder to appear in the IDE. Is it possible ? This way after a build it would be easier to get the apk and its also a good indicator when the build process is complete.
Here is what the IDE UI currently looks like, notice how its missing any output folder:
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.
I followed googles instructions and exported a test project from Eclipse by using the
Export -> Generate Gradle build files
opened up Android Studio and imported. After getting my support libraries working properly my project would compile with out any errors. My problem started when I tried to run the app on my device. When ever I try to run the app it directs me to use an AVD, never giving me the option to select my device. I obliged, created a new AVD but to no avail only to get build failed error. (I'll add the exact error when I can) NOTE: I can see my device is connected by clicking on "(6)Android" and the bottom left of the screen. I do see all logcat messages in verbose. I added android:debuggable="true"to my manifest but still nothing.
Confused I created a new project directly from Android Studio, hit run and bingo,...it gave me the option to use my device to run it or an AVD. Selecting either results in a successful launch of the dummy "Hello World" app. I think it may have something to do with build variants as my imported project doesn't specify "debug" vs "release" while the Android Studio generated project does.
Anyone else experiencing this?
I found the answer to my own question. Bit of a double whammy. Before installing Android Studio I updated my SDK via Eclipse (as recommended/required by google). Turns out by doing so a few items in my current projects got disconnected. ie. build paths, dependencies, ect. (you now have to place external Jar's in the src/libs folder)
Here is what I did to fix it.
In Eclipse, Preferences -> Java Built Path ->"Order and Export" tab. Make sure items are selected
If you have external Jars, manually copy and paste the jar in the libs folder of the project. (I did this in my Finder)
confirm the project launches via Eclipse
If it runs, export the project again by "Generate Gradle build files" (confirm overwriting existing files, if any)
5.Open Android Studio and re-import the project. Again, confirming overwriting of any existing files.
6.Next to the run bottom at the top of the screen click on the drop down next to your project name. Click "Edit Configurations..." and select "show chooser dialog" if not already selected.
clicked ok to exit,..and PRESTO!!! I finally have a successful project migration.
Hope this saves someone else time.
Cheers!
Yeah i have experienced similar stuff on Eclipse, its quite buggy. Since Android studio is based on it i would expect everything. Still the best solution to everything is to reload project, refresh project or restart IDE.
How do I create Android app builds similar to Windows code builds? I have my Android app code base checked in to Tortoise SVN. But I also have the binaries checked in - i.e the apk file etc. and not just the source code. Everytime there is a change I am building it manually on Eclipse and then updating the apk and the code folders. Is there no mechanism to create builds like on Windows where you run a batch file running the visual studio exe to create builds and binaries. I need this because otherwise it s just replacing the apk's everytime. Its very frustrating that I dont know this simple detail so please help!
You can use ant building scripts (details at http://developer.android.com/guide/developing/building/building-cmdline.html).
Actually you have to just checkin your project to SVN. The other team member or even you when loading it in another working space (another PC or diff Eclipse WorkSpace), Eclipse will throw error.
Simply clean the project it should rebuild the app and APK files for you again. Nothing much to worry. Me and my friends have done it several times.
Correct me if I'm wrong.