Android : How can I use DX option in eclipse? - android

I simply thought I could use jython for developing Android App.
But it was not easier than I thought.
I created android sample project and added jython.jar into the project.
After soon I encountered with "Conversion to Dalvik format failed" error msg.
So I googled almost every pages about that msg.
However I could not find a proper answer.
Closest answer was using "--no-locals" in dx option.
I did it in command console and it seemed to work well. I guess...
My question is...
I want to use the dx option("--no-locals") with eclipse.
Because eclipse automatically copys apk file to the emulator and runs it.
Is it anyway to set dx.bat option ("--no-locals") in eclipse?
Is there anyone who succeed in use of jython for android?

Now I don't know about jython.jar specifically, but it is not given that it is even possible to add every externaljar file to an Android project. It might very well be that your jar is depending on packages that are not included in the Android SDK (because Android isn't an exact clone of Java, just to have mentioned that), and if so it won't be possible to include it.
Try looking very closely on the error stack trace and look for anything indicating there are some missing dependencies. This might give you a clue if this is the case for your jar.

Related

Building a Github library project locally in Android Studio 2

Like many a newbie I've been blindly clicking away in Android Studio 2 stumbling my way through building an app. Most of it just works so I've not really got my head into gradle.
Any road up, I've wanted to link into Strava and discovered that there were a couple of guys who had done the heavy lifting but on using a specific project, at the vital point of getting the data there is a coding problem. I thought the best approach would be to solve the problem and feedback.
So I downloaded the GitHub project in a zip and tried to do a standalone build and then things just didn't work. I think the basic problem is a) I don't know what I'm doing, and b) presumably the build on GitHub was done using different tools that are not set up for Android Studio.
So given that there is a working project on GitHub (specifically https://github.com/SweetzpotAS/StravaZpot-Android ) what are the dummy steps for getting that project to build locally in AS 2?
The problems I had are that on trying to open the project picking up the gradle file (couldn't find anything else to open in the root directory, the build didn't want to work - complaints about mixed projects. I stripped out the testing app and just tried to build the lib, but I didn't get a working lib in the output directory, just 2 25k stub aar files. Ideally I want to have that as a standalone project to build a local lib and then use that lib in my project (which I reckon is within my abilities!). Run out of Google search ideas!

Running a kivy program on Android

First of all i am aware that there have been alot of similair questions asked already, but somehow i cant figure anything out, I have a python-kivy program that I want to run on Android, the program works perfectly on my computer, I've ran various simple programs using Python Interpreter with Kivy, so far it was the best open source I could find, but there is some nasty problems with it.
I've been to https://kivy.org/docs/guide/packaging-android.html#packaging-android and since i already had Kivy Launcher installed on my phone i tried that one first, however when i open the app i get a message:
No projects are available to luanch. Please place a project into storage/emulated/0/kivy and restart this application. Press back button to exit.
at https://kivy.org/docs/guide/packaging-android.html#packaging-android I readed that the 'project' consists of my main code, lets say main.py, and android.txt, the android.txt must contain a few things that i wont mention now, these two files must be placed in a folder and placed at the asked directory.
I did this, but i still got the same message.
I've thought of trying Buildozer, but i did not seem to find a proper instalation for it on android.
I'm asking advice, becouse i think that the answer to my problems might not be so dificuilt, so any advice apreciated.
Thanks and regards.
Cid-El
ps. Android Lollipop, python 3.4
You may try using buildozer to package your app and deploy to Android device directly for debug, you only need to install this in your machine, and change the developer options in Android to allow external source.
Basically once you install the buildozer, you need to initialise a project by:
buildozer init
Make sure you have the required dependencies and targeted Android SDK/NDK in your system.
Then it's only a simple edit the build manifest for Python specific dependencies (external modules etc).
And run locally by:
buildozer android deploy run
Read more about buildozer here
Hope this helps.

How do you control Eclipse's generated Bluetooth java files?

I've got an Android project built under Eclipse-Indigo that works just fine. I recently copied many of the files and rebuilt under Eclipse-Juno. The app runs if you install it and/or run it from Eclipse, but if you try to generate an APK, you get:
Conversion to Dalvik format failed: Unable to execute dex: multiple dex file define Landroid/bluetooth/IBluetooth;
Comparing the directories shows that src/android.bluetooth/IBluetooth.aidl and IBluetoothCallback.aidl are identical, but gen/android.bluetooth exists in the working version but not the broken one. Replacing these files manually makes Eclipse whine, of course, so the question is:
how do I control how Eclipse generates those particular files from the AIDL inputs?
Alternatively, if somebody has an intelligent suggestion as to how to get rid of the stupid error, I'll take that instead :-)
The answer is to NOT install the Android Development Kit, which seems to have borked libraries. Instead, install Eclipse for Java Developers, and install the Android SDK separately. This allowed the correct libraries to appear, and didn't give the stupid errors about duplicate dex files.

Developing Android on Sublime Text 2

I wanted to start developing for Android, but found it terribly hard to set everything up so it would work on Sublime Text 2.
I know that I'm supposed to download and set up the Android SDK, but how, where and why? And how do I compile my projects and run them? This is a complete mystery to me.
I've been researching this for about 3 hours now and haven't had any success. Could anyone of you, please, help me by guide me through the process of setting everything up in ST2?
Please note that I do not want to use Eclipse IDE. I've grown to love ST2 and I'd like to stick with it.
I know that I'm supposed to download and set up the Android SDK, but how, where and why?
Visit the official site and follow the instructions for "other/existing IDE". I don't think anyone wrote specific instructions for using Sublime yet though (since you haven't found one).
And how do I compile my projects and run them? This is a complete mystery to me.
As others already answered, other than a JDK, you will most likely need to download and run Ant from the command line.
If you really want start Andriod development, without using the great support of an IDE like Intelji Idea or Eclipse, then you should properly look into building and running your applications in the command line beside Sublime Text 2
If you follow the instructions for using the 'Andrew' software module from github, you can get sublime to communicate with the android sdk and ant build tool via a tool called monitor.
https://github.com/Korcholis/Andrew
Kind of similar to a vim addon i used to use that talked to eclipse service.
But if anyone else is reading this, intellij (android studio) has come on leaps and bounds regarding speed and autocomplete.
Eclipse and IntelliJ are the known supported IDEs for Android development. If you don't want to use Eclipse or IntelliJ, read up about ant scripts and how to build with Ant. That should get you started.
Sublime Text 2, right now doesn't support Android development from within the IDE. The only option you have, other than using Ant, is to wait for someone to write a plugin for that.

How can scala applications for android be reduced in file size?

I am attempting to write Android applications with Scala in Eclipse. The problem I'm running into is that the deployed APK file is much too large - since you can't link Android apps to external libraries, any code used has to be copied into the APK file, but most Scala apps don't need most of the Scala library. Somewhere I read that even a large application can be packaged with only 50kb or so of the Scala library, compared to the 4mb that my Android device is telling me my test app takes up.
I've already tried the Treeshaker plugin for Eclipse, and I can see in the progress window that it is running, but it doesn't seem to do anything. Disintegrating it from my project doesn't have an impact on the final file size. I've also tried configuring Proguard myself, but I can't find a configuration that doesn't either not affect the file size (and I realize that Proguard only runs when use Eclipse's export wizard, which I used to test this) or crash with cryptic error messages, such as "1". (Well, ok, the entire error message is "Conversion to Dalvik format failed with error code 1", which is hardly more helpful because I can't find any clear documentation of that error message and it doesn't tell me what part of my code or configuration is causing the problem...)
So. Any insight on how I can get this working?
Most people use SBT with ProGuard (as far as I know it is run automatically with the sbt android plugin).
Additionally, there is the possibility to ship with two dex files in a apk. This also solves many problems, because most restrictions apply to the dex files, not the final apk.
This is older, but has many useful general information: http://lamp.epfl.ch/~michelou/android/
I use AndroidProguardScala as given here:
https://stackoverflow.com/a/11084146/1287856
It uses Proguard when exporting the application, and it works pretty well.

Categories

Resources