[Q] Developing on Device - Android Software Development

I have programmed in java for quite some time, and am decent at android apps.
However, i have two questions about developing on my device (rooted samsung captivate).
First, how can i get dev tools to run correctly on my phone. I have installed it as stated in "developer.android com/guide/developing/debug-tasks html#additionaldebugging". However, when clicking on Dev Settings it crashed with HARDWARE_TEST security exception. I have read that you need to sign/run it as system.
Is it possible to run it on my rooted captivate? if so how do i install it as system or find the system signature to sign it.
My other question is about programing, compiling, and running android applications from a device. I can take my .apk and unzip it. Then edit any resource files. Then rezip and sign it. However if i want to replace the actual code i need to compile it. I can use an online java compiler but i need to convert it to android format.
I know that dx.bat does this by using dx.jar . I can add dx.jar to the referenced libraries of my app. However i cant figure out what to do past there. Is what i am attempting even possible?
Thanks for your help.

There's a couple threads in this forum from folks like me who want to do this. Perhaps you can help us figure it out
Step one is I think to get an java compiler running on the phone. Then to make a version of DX that can run on the phone to convert the class to .apk

Thanks. in normal java programs you can use "com.sun.tools.javac.Main.compile( new String[] {args} );" found in the "<sdk>/lib/tools.jar" to compile a program. And dx.jar is what is used to covert it to android, however i do not know what to call in it.
We just need to find a way to get these jars to work on android.

Related

[Q] A call out to the Galaxy S ROM delevopers, help needed!

Well hello everyone.
I am an application development student from Belgium.
I am proficient in Java, VB.NET, some c/c++ and also PHP/JS/HTML/CSS
Anyways, my recent interest has been going out to creating custom roms for the galaxy S!
The problem now is though, I was able to find some guides and such, but most were incomplete, and for HTC(and other) devices.
I have no idea what is different between making a ROM for galaxy S or a ROM for an HTC device.
If anyone would like to link me to some good resources that can help me on my way, or would like to collaborate (and in the meanwhile teach me a bit) I would be more than happy! (I am open for collaboration as I am pretty proficient in Java and I'm always happy to code and learn more about coding!)
I think the question is really want you want to do!
Custom ROMs for Android are as simple as using recovery console to replace files on the system with your own versions.
ie. Replace the framework.apk which contains all theme images with your own modified one, which you can use to skin the device. Same for replacing other system apps.
Unfortunately, most of these apps are closed source, so modifying them is difficult. The stock android system has open source versions of most of them though, and you can modify those and build them, and then replace the ones on the device. I'm not entirely sure how to build them up though, but it probably isn't too hard.
Then there are custom kernels, which let you actually change the underlying linux system underneath android - Samsung has an open source version of the kernel available that you can compile, and then flash to your phone using Odin or other tools. Compiling the kernel is pretty tricky though.
Well i'm really talking about stuff like SamSet, MoDaCo, Doc's ROM and others.
I'm not saying I want to create a pro ROM in a day or anything, but i'd really love to learn more to get better (always looking for more stuff to put on the resume, I guess?!)
Thanks a lot,
Kenny
Bump for some help
(sorry for the double post but i'm really eager to learn)
I don't have time to give a detailed response right now. However you will want to read up on yaffs (file system) and odexing/deodexing ROMs.
Thank you I will definately do that,
I am following a guide now to start out creating custom ROMs for android, however it was written for Motorola Droid and I have no idea what you have to do different for a samsung galaxy s.
I am a good coder, even though I say so myself, with a lot of experience. I also have a lot of linux experience, you name it
Only the problem is the old, and much known "where do I get started?"
So if anyone can point me out in the right direction on that, tell me how/where you started out, I would appreciate it greatly!
Thanks!
Very sorry to bump again
I set up my environment in ubuntu today to get started (just gotta fix a few errors, didn't know android wouldn't compile on java 1.6, only on 1.5)
Anyways, still need some help here! thanks!
Again I am awefully sorry for the bump here but i'd really like some help.
Note that i'm not a newbie at coding whatsoever and i'm not unfamiliar with some hardcore java, c/c++ and other languages, I'm just having trouble getting started when it comes to modding an existing android release (there are tutorials on HTC and other devices but some methods do not apply to the galaxy S)
If you're trying to create a ROM from scratch then unfortunately you're out of luck at the moment. No one has really managed to do so yet. By "from scratch" I mean the Android Open Source Project (i.e. official Android git repository).
What you can do is grab an existing firmware. Extract the contents, de-odex the apks, modify them or add new apks, optionally you can also compile a custom SGS kernel using Samsung's kernel source. Then you can re-odex the ROM, pack it back up and distribute it.
There's no real "starting place" as such and you won't yet find any tutorials about how to create SGS ROMs. Just give it a go and see where you get.
Yes, I do mean creating a ROM from stock samsung firmware, of course.
So my next logical question would be now:
How do I go over extracting contents from the existing samsung firmware, de-odexing and so on?
Any links/guides/tips are greatly appreciated, as long as they are applicable to this cell phone and not totally crap, thanks!
Samsung uses rfs, I think you should know. There is a thread somewhere in this forum regarding extracting .rfs file. Understood you need Debian though.
For some readup, go search for a famous guy named JesusFreke. Tons of materials...
Hope that from here onwards, this can lead you on, and to find out more. Google is your friend too...
I'm afraid my biggest problems already occur in setting up the environment, so it's really the very beginning that gets me stuck, i'm sure coding would be a bikeride compared to setting up the environment for me (i'm no hero in linux,not at all, i'm afraid)
How the hell do I get from point A (being downloading the full source) to point B (starting to create a custom ROM?)
thanks
of course if anyone has the time, and wants to, you can PM me your msn or something, if anyone is up to it
Raykoid666 said:
I'm afraid my biggest problems already occur in setting up the environment, so it's really the very beginning that gets me stuck, i'm sure coding would be a bikeride compared to setting up the environment for me (i'm no hero in linux,not at all, i'm afraid)
How the hell do I get from point A (being downloading the full source) to point B (starting to create a custom ROM?)
thanks
of course if anyone has the time, and wants to, you can PM me your msn or something, if anyone is up to it
Click to expand...
Click to collapse
Agreed completely! Getting a full cross-compilation to Samsung's Android going is seriously difficult! There have been some promises for tutorials and guides for setting things up though, but none have appeared yet. Probably because it's hard!
Well thank you for agreeing with me on that.
I am really hoping for anyone that can help me out here, either on here or in private, and give some detailed instructions on how to get started.
Hell there is enough information on creating roms alread, deodexing, adding/removing apps etc etc etc... The real problem lies in setting everything up properly.
I think I have gotten to the point where I'm compiling the android source (without samsung specific files)
note i'm saying "i think i am compiling" because i'm hoping it won't error out on me again after an hour of compiling!
But once that is done... I have no idea where to go next, where to get the samsung specific files, or what to do with them whatsoever once i have them
thanks!
Android generic source won't actually help you much. Samsung has made a huge number of changes to it, and while it is all open source, backporting their changes to get your stock source running on the phone is a major undertaking. I believe cyanogenmod was actually working on this, but it seems without much success so far.
What the other rom makers you see are doing is taking a snapshot of a running rom, copying over all of the APKs and the files on a running device, and then tweaking those. ie. Opening up framework-res.apk and changing the image files inside.
The update.zip roms that are what most people are doing are really just using the Android recovery to replace files on the phone with their own versions. Since the underlying system is linux, and everything is a file, this actually works pretty well.
The kernel development effort is completely separate from the rest of the system though, and Samsung has provided the entire source tree that just has to be compiled. I'm a bit stumped myself on all the details of setting it up, but I have seen some threads on this forum about it, and it didn't seem too bad to set up. Apparently you shouldn't use the codesourcery toolchain though, or something. Not too clued up on it, sorry. Hopefully someone with the details can chime in, or give us a link to the old post on it (I'm failing to find it using the search function! )
Alright sounds good!
So these recovery files you are talking about (the contents of /system) how do i retrieve those from a base ROM such as JM7 or the likes after a clean flash?)
Raykoid666 said:
Alright sounds good!
So these recovery files you are talking about (the contents of /system) how do i retrieve those from a base ROM such as JM7 or the likes after a clean flash?)
Click to expand...
Click to collapse
Root your phone, zip them up onto the sdcard, and then copy them off.
There are probably better methods, but this works fine.
Also, with credits to Unhelpful, he has told me that the correct toolchain to be using is 'uClibc or eglibc toolchain with ct-ng'. I have no idea what to do with that yet, but it's a start.
RyanZA said:
Root your phone, zip them up onto the sdcard, and then copy them off.
There are probably better methods, but this works fine.
Also, with credits to Unhelpful, he has told me that the correct toolchain to be using is 'uClibc or eglibc toolchain with ct-ng'. I have no idea what to do with that yet, but it's a start.
Click to expand...
Click to collapse
You don't even need to root your phone to pull /system Ryan
adb pull /system <random folder>
is all you need ^^
Alright thank you, I managed to get all the /system files using abd pull /system
now next thing up would be de-odexing right, before I go editing stuff?
Now before I go de-odexing. Can anyone tell me what exactly de-odexing is and why I need it?
and what do I need to do to create an update.zip again?
thanks a lot all!
Tayutama said:
You don't even need to root your phone to pull /system Ryan
adb pull /system <random folder>
is all you need ^^
Click to expand...
Click to collapse
Haha cool, didn't know you could pull whole folders!
Raykoid666 said:
Alright thank you, I managed to get all the /system files using abd pull /system
now next thing up would be de-odexing right, before I go editing stuff?
Now before I go de-odexing. Can anyone tell me what exactly de-odexing is and why I need it?
and what do I need to do to create an update.zip again?
thanks a lot all!
Click to expand...
Click to collapse
The apk files in Android are odexed - that means they have a special index applied for dalvik that speeds them up somehow! I don't know how, I haven't checked how it actually works.
The important point is though:
odexed is faster, but you can't edit it because of signatures or something technical
deodexed means you can change it however you want
More useful info can be found from google - lots of it!
update.zip is easy - it's a zip file in a special format that can be understood by Android's recovery console. The easiest way to do it is to grab an existing update.zip and modify it as needed. Tayutama has millions of em around, so use his!
Then you need to sign it once you're finished with it so that the SGS will accept it. Samsung made a boo-boo and didn't disable the test keys for the 2.1 SGS firmwares. That makes it easy!
http://www.londatiga.net/it/how-to-sign-apk-zip-files/
Just use the test keys to sign it, and then copy it to /sdcard/update.zip and reboot into recovery and it'll work.

Need help installing the Android SDK

I've read the other threads about this but there is no help to be found there unfortunately.
I've been playing with App Inventor because I wanted to avoid learning Java but my think now is that seeing as I do JavaScript/PHP/mySQL and HTML/CSS anyway I might as well do my app development properly.
I've been following the instructions at the official developer.android.com site.
and the part where I have the problem is with Eclipse - at step 1 on that page. I've installed the JDK but when I try to install Eclipse I get an error telling me that there is no Virtual Java machine in the eclipse\jre\bin\ folder.
Well I'm following the instructions so what can I do about this? I don't even understand the error. Is there supposed to be a file in this folder, a folder which a.doesn't come with the standard Eclipse .zip file and which b.doesn't exist at all!
I tried this all before some time ago and got the same problem. At that time I couldn't even use App Inventor because of some JDK/JRE problem but I un-installed and reinstalled Java and App Inventor is working now.
This is one of the most frustrating computing problems I've faced because I've searched all over for an answer and there is nothing out there. Frankly I'm a little surprised at how poor the installation documentation is
The only thing I can think of is I have the wrong version of Eclipse. Which exact one is everyone else using?
Hello Subjective Effect. There is not a folder named eclipse\jre\bin in eclipse installation folder. The version i m using is eclipse-helios. I was not faced the problem you have.
I've solved that part of the problem by downloading a different version of Eclipse. It is a Helios version and is the one with Java. The installation instructions are not clear on this.
I now have another issue but I'll try work that out for the time being.
So I've no idea (again because the instructions are so poor) what to do about this.
I'm on the Android Developers site and trying to start the Hello World tutorial. I'm already stumped at the stage of creating a New Project because after I set up Project name, Application name, Package name and Create Activity clicking "Finish" gives this error:
[2010-10-28 01:33:03 - HelloAndroid] ERROR: Unable to open class file C:\workspace\HelloAndroid\gen\com\subjectiveeffect\helloandroid\R.java: No such file or directory
The reason I think the docs are poor is am I supposed to have created this directory or does Eclipse create it for you? And if it's supposed to be created for you what am I doing wrong?
Subjective Effect said:
So I've no idea (again because the instructions are so poor) what to do about this.
I'm on the Android Developers site and trying to start the Hello World tutorial. I'm already stumped at the stage of creating a New Project because after I set up Project name, Application name, Package name and Create Activity clicking "Finish" gives this error:
[2010-10-28 01:33:03 - HelloAndroid] ERROR: Unable to open class file C:\workspace\HelloAndroid\gen\com\subjectiveeffect\helloandroid\R.java: No such file or directory
The reason I think the docs are poor is am I supposed to have created this directory or does Eclipse create it for you? And if it's supposed to be created for you what am I doing wrong?
Click to expand...
Click to collapse
Mine seems to have that error no matter what I type in.
So what have you done about it? Or can I continue without worrying, is this a trivial error message?
1) you should download Eclipse 3.5.2 as Helios is not supported by Android plugin yet.
http://www.eclipse.org/downloads/packages/eclipse-classic-352/galileosr2
2) R.java problem should go away if you restart eclipse
Also, to start with better use the existing sample project HelloWorld rather than setting up your own.
This is a common known bug. You can use the latest eclipse version, once you setup a project, you will have to go under project properties and choose compiler version 1.6, which is set to 1.5 usually.
Tha will solve the problem, because i was facing the same a few days ago when starting to mess with SDK and Eclipse.
I had a similar problem and gave up for awhile and when I came back to it I found out that I didn't have my paths set correctly for the java jdk, not sure if that is it but it worked for me.
I find if I restart Eclipse it fixes things.
I've been playing with layouts!

Wanted: Compile for Android ON THE DEVICE!

Way back when, I could run a c# compiler on my Windows Mobile phone and create apps. I think it would be fun to do on-device "compilation" on my Desire Z too.
I'm not asking for an IDE -- just something that can take Java source code and XML files, compile to bytecode for Dalvik and produce an .apk -- all on the device itself.
Is this possible?
OK -- we'd have to both a javac (java compiler) and a dx tool running on the device to do this. The first compiles the java source, the second takes that file and converts it to Dalvik bytecode.
Anyone else interested in this?
I'm very interested too. I tried sl4a but it's limited for now.
Sent from my Desire HD using XDA App
Dexify java compiler
I'm also very interested!
I develop in Java for the Eve VM on Windows Mobile: [www t-arn com/software.htm]
but for this I needed to install a JavaVM on the device.
But it should be possible to dexify the java compiler. I found following post:
[www ist-music eu/developer-zone/documentation/phoneme-and-osgi/music-on-android]
The porting of OSGi requires the dexification of the OSGi bundles. This is a process which makes any JAR file (compliant with Java VM) compatible with Dalvik VM. It basically consists on adding a new file, classes.dex, into the JAR file. To dexify each OSGi bundle, a two-step process is required by using the Android SDK tools. In windows, the process would be:
* Create the classes.dex file associated to the JAR file:
[ANDROID_SDK]\platforms\android-1.5\tools\dx.bat --dex --output=%CD%\classes.dex my_bundle.jar
* Incorporate the classes.dex file into the JAR file:
[ANDROID_SDK]\platforms\android-1.5\tools\aapt.exe add my_bundle.jar classes.dex
Now, the dexified bundles work on both VMs: Java VM and Dalvik VM.
Click to expand...
Click to collapse
I guess, we could do that for javac. If this does not work, we could try another Java compiler:
- EJC: [thecoderlounge blogspot com/2010/05/ecj-eclipse-java-compiler.html]
- kopisusu: [klomp org/KopiSusu/download.html]
I have no idea how to dexify the dx tool, though :-((
Hope to hear more from you guys
Tom
I have not yet gotten the Android SDK (nor a device...) but it seems that the dx tool itself is written in java. There is a dx.jar in the SKD. This one might already be dexified...or we could dexify with itself.
Tom
On-device development & compiler on a server...
Hi guys, I'm new to this Forum - just got my Archos 101 and now I'm searching for some more fun with it ;-)
So I really liked you guy's idea of having a compiler on the device itself - especially since the java compiler's really fast, so no doubt it can run on a smartphone...
I was really tempted by the open source "Open Blocks" library (education.mit.edu/openblocks) from some of these "Lifelong Kindergarden" people at the MIT... they're having this neat programming environment for teaching children programming, where you can drag/drop your source code like Lego...
Here you can have a look how the programming looks:
education.mit.edu/webdav/How%20to%20Create%20a%20Procedure/How_to_Create_a_Procedure.html
Now even google is using a similar thing, probably the same sources for their "App Inventor" (appinventor.googlelabs.com/about/), but you can only develop online at a real pc, then the .apk file is packaged on the server and downloaded to your android device...
So that's practically another way of having stuff compiled "on your device" - you could do the the development on a device and then have a server dedicated for a fast compiler and dx run...
Basically, I'd say that's the perfect system to write quick programs on a touchscreen device, especially when it's a bit larger tablet...
So if anyone wants to join in, I think I'm really keen on trying to port this OpenBlocks thing to the android screen ;-)
Cheers,
wowbag
Java IDE on Android
Hello everybody
I have just finished the latest version of taJavaIDE (0.3.0)
This APK is meant to become an Android development tool with which you can create native Android apps (APKs) ON the Android device itself.
What is working so far (on my Desire HD):
- Eclipse compiler for Java is integrated and working
- dx tool is integrated (not yet tested properly)
- BeanShell Interpreter is integrated and working.
You can write your own BeanShell script, store it on your SDCard and automate
the build process with it.
What is NOT yet working:
- aapt
- apkbuilder
- jarsigner
- zipalign
apkbuilder and jarsigner should not be a problem. I think, I can integrate those in the same way I integrated ecj.
As far as I know, zipalign is not absolutely needed (I might be wrong here, though).
My biggest problem is aapt which is not a Java application but a C++ application. To make it run on Android, you would need to port it to Java (looks like a REAL challenge!) or use the NDK to create a native library that you could then access from the APK.
I have no experience with the NDK and I also don't have the necessary build environment, so I would really appreciate if someone would help me out here!
Anybody interested in contributing?
Tom
Wow, thanks for getting this started, t-arn!
It's been forever since I did any C++, but I'll take a look at aapt and see what I can figure out.
Hopefully, a true C++ programmer will come along and set us straight
I'm very interested in this project and I would be willing to try to help out if you need it. I'm a second year software engineering student and I'm currently on a work term where all of my work is with android. I may not be of much help but at least I think I have some idea what I'm doing so let me know.
you are correct in saying that zipalign is not necessary. we only need it if we want to sign the apk in release mode(for publishing it to the market). We could just use debug mode and everything would be fine. I'm sure that if someone wanted to release an apk to the market, they could just copy the files over to their pc and zipalign it there. We would still be able to use the apk on the device without using zipalign.
t-arn said:
- jarsigner
Click to expand...
Click to collapse
Serison has an application on the market to sign APK's. Just thought I would let you know it is possible.
I would like this as well, as my phone has a physical keyboard and typing code isn't that bad on it - atleast not for minor edits/tweaks
JavaIDEdroid open source project
Hello everybody
I have created an open source project for JavaIDEdroid:
http://code.google.com/p/java-ide-droid/
Everybody is welcome to join the project (and hopefully contribute to it!)
As soon as I have cleaned up the code a little bit, I'll upload the source and the current APK.
For further questions and discussions, please join the java-ide-droid group. You'll find the link on the project's home page.
See you there!
Tom
Sounds pretty promising,looking forward to give it a try!
Sent from my Dell Streak using XDA App
Sounds possible, if you have the right components. I would love this. Would definitely donate to whoever got it working easily and 100%.
Very interesting project
Look nice. Downloading now.
I have wanted this since I first got an android phone.
I ended up using a virtual debain command line running OpenJava to compile and run the stuff. But if i can do it without that hastle in one app, I will LOVE you.
Edit: I tried it out. Mind explaining how to make a beanShell script? on the ECJ it always gives me a security exception even with just -help.
Code:
java.lang.SecurityException
at java.lang.System.setSecurityManager(System.java:610)
at com.t_arn.JavaIDEdroid,.DE.fnCompile(IDE.java:44)
at com.t_arn.JavaIDEdroid.MainActivity.fnCompile(MainActivty.java:167)
at com.t_arn.JavaIDEdroid.MainActivity.tabCompile_btnCompile(MainActivity.java:137)
......
Done in 1305348377 sec.
Please join the JavaIDEdroid support group at http://groups.google.com/group/java-ide-droid and re-post your question there.
I'd like to keep discussions there.
Thanks
Tom
very interesting, ill join the group, i can make the native lib for the aapt.
I would say get gcc working on the device then you can compile anything. You can compile a javavm. A native binary. Etc. If gcc can be compiled and work then all programs most likely can be compiled on the device assuming the proper libs are there to compile against.
Sent from my Incredible using Tapatalk

[Q] Compiling RILAnalyzer

Hello, I am running Jedi Rom X19 on my Verizon Note 2. As part of an academic project, my professor wants me to build and run RILAnalyzer on my phone. I get everything set up but when I get into eclipse, it complains that some internal libraries are missing, specifically com.android.internal.telephony.phone and com.android.internal.telephony.PhoneFactory.
I can't continue in the project without this application compiling. Where do I get these libraries?
Normally, you don't have access to internal and hidden api as they are not present in the android.jar of your sdk. You need to use a patched sdk to use them. See this guide, it explains everything beautifully.
http://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/

[Q] Problem getting started on Android Studio

Hey guys,
I have been having trouble getting started developing applications for android. I know how to use Java, and frequently use the netbeans ide for my java homework ect. But I decided why not adventure out and build upon what I learned in school. Unfortunately I have ran into nothing but problems. The first problem is this:
"Gradle project sync failed. Basic functionality (e.g editing, debugging) will not work properly. "
In the messeages window it reads:
[file path to \app\build.gradle]
Failed to Find: com.android.support:appcompact-v7:21+
I have had trouble using grade in eclipse....well I only got eclipse to work once, when I first got my phone, and managed to make a small pop-up app for my self. I did not know any programming language at the time. I merely just copy and pasted most of the code.
and problem number two;
The generated code is riddled with errors?
I look through most of these errors and they state that certain things can be resovled. For example, cant resolve "support" <--- I think that by not having this imported correctly (I think this falls into the first problem) is causing the rest of the errors in my MainActivity file to go crazy.
Is their any way to post more information? Like a log file, maybe that might be of more help too. I just am unfamiliar with Android Studio, as of right now. Attached is a picture of the IDE when is spawns the error.
Thanks for the help in advance!
How to Fix said issue
KJ4CCH said:
Hey guys,
I have been having trouble getting started developing applications for android. I know how to use Java, and frequently use the netbeans ide for my java homework ect. But I decided why not adventure out and build upon what I learned in school. Unfortunately I have ran into nothing but problems. The first problem is this:
"Gradle project sync failed. Basic functionality (e.g editing, debugging) will not work properly. "
In the messeages window it reads:
[file path to \app\build.gradle]
Failed to Find: com.android.support:appcompact-v7:21+
I have had trouble using grade in eclipse....well I only got eclipse to work once, when I first got my phone, and managed to make a small pop-up app for my self. I did not know any programming language at the time. I merely just copy and pasted most of the code.
and problem number two;
The generated code is riddled with errors?
I look through most of these errors and they state that certain things can be resovled. For example, cant resolve "support" <--- I think that by not having this imported correctly (I think this falls into the first problem) is causing the rest of the errors in my MainActivity file to go crazy.
Is their any way to post more information? Like a log file, maybe that might be of more help too. I just am unfamiliar with Android Studio, as of right now. Attached is a picture of the IDE when is spawns the error.
Thanks for the help in advance!
Click to expand...
Click to collapse
Ok guys, I figured it out. We need to install a package from the sdk manager. The picture shows which one needs to be installed. The package is "Android Support Repository"
Seems you have already gotten the answer. But for this kind of questions, past the main line of the error log into Google is much faster than post a question, I think.

Categories

Resources