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
Related
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.
I started with cordova and I have some small problems.
I've created an android application. I have installed java, android SDK , Apache Ant and Apache Ant.
I have added android with cordova add platforms android and builded correctly.
1 - When I use cordova run android I get the following error:
an error occured while running the android project . Buildfile : ...Demo \ platforms \ android \ build.xml . ERROR : Failed to install apk to device
I think this is due to the fact that my application is not in debug mode. How to set the debug mode? (' cordova emulate android ' works and launches the emulator )
2 - When I want to load a project in eclipse . (New project - > Android Project from Existing Code) I have the error:
Invalid project description Reason : . Invalid project description
How to overcome this error ?
3 - I want to install external plugins, eg
- https://github.com/ClickInnovate/CordovaPhoneGapPlugins/tree/master/Android/SocialMessage
- https://github.com/phonegap/phonegap-plugins/tree/master/Android/StatusBarNotification
It is said that to copy the java files in the src folder , but, I copy the java files in the original project or one that is build ( in plateform directorie )
If you run cordova run android -d, you will see additional debugging information printed to the console which should hopefully help you narrow down the problem. I've never seen that error you are getting, but to set your device up for debugging you should follow these steps. Some steps may be different or unneeded based on your Android device and version:
Settings --> Click on "About Tablet" --> Click on Build Number 7 times to activate "Developer mode"
Settings --> Developer options --> USB Debugging (make sure it is checked)
Settings -->Security-->Unknown Sources` (make sure it is checked)
Storage --> Click the drop down on the top right --> USB computer connection --> Make sure "Camera (PTP)" is checked
Please ensure that you are following the Android platform guide. If you are getting "Invalid project description" you might just need to type in a project description in one of the boxes in Eclipse? Another thing, make sure you are doing Import-->Android-->Android Project from Existing Code. Finally, it sounds like this might be a goofy Eclipse environment issue, here is another question on SO about this problem.
The plugins that you listed are old, they were made before Cordova 3.X came out. In 3.X, a new plugin management system using Cordova CLI and Plugman is used to install plugins - the only problem is that the plugins need to be updated to use this new format. You could look around to see if somebody has updated those plugins (look on the Fork page on GitHub is one good way.) Otherwise if you can't find an updated plugin, you could try to update the plugin yourself following the upgrade guides on the doc website. To answer your question, the java files would be need to eventually be copied into the build folder. In 3.X, the files are stored in the /plugins/ folder, then copied to the /platforms/android/ folder when you run cordova prepare, and are built into the cordova.jar when you do cordova compile. You can also read about how to install plugins with just plugman.
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.
It used to be that after making changes in my code, I could simply click run in netbeans and the updates would be evident in the android emulator. Now, for some reason, I have to click "Clean and build" first, then run. If I simply click run, the version from the most recent compile will be pushed the the emulator. I have no idea what changed.
This sounds like a bug. Please file a bug against the plugin. There is a guide for this at http://www.nbandroid.org/p/contacts.html
It will be good to know plugin version, Android SDK version and NetBeans version. In addition to that you can take a look at the output from Ant verbose build to see if the .apk file deployed to emulator is really rebuilt (there is a button on the left bar of output window that leads you to a page where you can adjust Ant settings to print this verbose output).
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.