Transferring a Basic4Android Project into Eclipse

Fixx42

Member
Licensed User
Longtime User
Is there a way to transfer my entire Basic4Android project, with the attached layouts and files, into Eclipse?

I am a (very) novice coder that has gotten pretty far with Basic4Android, but I am entirely unfamiliar with Java. Now, however, I am trying to create a program for the Android-based WIMM watch which requires me to make some alterations to my code/Manifest/layout in Java/XML, and compile in Eclipse. At least, that's how WIMM's documentation explains the process.

I understand that Basic4Android converts my code to Java in the compiling process, but I'm not sure where to find that or how to also load my layouts and other project files. Any help or advice would be much appreciated!
 

moster67

Expert
Licensed User
Longtime User
I have never tried it but I noted that Erel has written in the FAQ-part on the main-site the following comments:

Q: Can I export my source code to a Java project?
A: Yes. During compilation Basic4android generates Java code. The code is available under the Objects subfolder.
You can copy the Java source code to a different folder and use it outside of Basic4android.
You will also need to reference Core.jar and BAShared.jar which are included in the installation.

Please let us know if it works!
 
Upvote 0

Fixx42

Member
Licensed User
Longtime User
Thanks Moster. This may be a silly question, but - if I were to make changes to the Java source and then compile from that - do you know how I would go about also including my project's layouts and files in the compiled APK? That's where I'm getting a bit stuck... I don't suppose those items are included in the .java file that Basic4Android puts together?

As you can probably tell, I'm a complete novice with this stuff. Thanks for the help!
 
Upvote 0

ietv

Member
Licensed User
Longtime User
If you're going to test your app on the Blackberry Playbook or simulator before submitting it, you need to import it into Eclipse.

I have not been able to do this yet. l get 200 errors, which I assume is the max it will show. I think these are related to the project not being able to find BAShared.jar and Core.jar.

Can someone please explain where everything goes if you're importing into Eclipse to test on the Playbook?

Thanks.

UPDATE: I was able to resolve the errors by adding BAShared.jar and Core.jar plus all of the libraries I used as external archives in the build path. The app installed in the simulator, but the splash screen does not show correctly. Still waiting to see if the rest of it works - just like my previous experience with VMWare virtual machines, it's incredibly slow.

2nd UPDATE: Doesn't work. Tries to start, ends itself immediately.

Any advice on how to fix things?
 
Last edited:
Upvote 0

Fixx42

Member
Licensed User
Longtime User
Hey ietv, I've actually been testing on the Playbook Simulator without importing into Eclipse. I use BlackBerry's online repackaging tool to turn B4A's created .apk files into .bar files, and then sideload those onto the simulator.

My process:
- Use the online repackager to convert the .apk to .bar. The .apk is in the "objects" folder of your project, and is generated when you hit compile/run. Link: https://bdsc.webapps.blackberry.com/android/bpaa/

- Use the blackberry-deploy command line tool to sideload the .bar onto the simulator. Instructions here: Package and deploy your application from the command line - Development Guide - BlackBerry WebWorks SDK for Tablet OS - 2.0

The blackberry-deploy utility comes with the various tablet SDKs. I got it by installing Adobe's Air SDK, and then BlackBerry's Tablet SDK for Adobe Air.

Let me know if you have questions!
 
Upvote 0

Fixx42

Member
Licensed User
Longtime User
It is possible to take the generated Java code and add it to an existing Android project. However it requires a good Java knowledge.

It is easier to make a Java library and add it to your project.

Thanks Erel! Is there any documentation available on how to convert B4A apps to Java libraries? I didn't have any luck with Google. Also, using the Java library method, I don't suppose that would also carry over my layouts and sound files?
 
Upvote 0

ietv

Member
Licensed User
Longtime User
Hey ietv, I've actually been testing on the Playbook Simulator without importing into Eclipse. I use BlackBerry's online repackaging tool to turn B4A's created .apk files into .bar files, and then sideload those onto the simulator.

My process:
- Use the online repackager to convert the .apk to .bar. The .apk is in the "objects" folder of your project, and is generated when you hit compile/run. Link: https://bdsc.webapps.blackberry.com/android/bpaa/

- Use the blackberry-deploy command line tool to sideload the .bar onto the simulator. Instructions here: Package and deploy your application from the command line - Development Guide - BlackBerry WebWorks SDK for Tablet OS - 2.0

The blackberry-deploy utility comes with the various tablet SDKs. I got it by installing Adobe's Air SDK, and then BlackBerry's Tablet SDK for Adobe Air.

Let me know if you have questions!

Thanks for the help! That seemed to be much easier, but it ended in an error: Unable to find result reply. Seems to be a common error and may be related to the device timing out.

Any ideas?
 
Upvote 0

Fixx42

Member
Licensed User
Longtime User
No idea. I had a whole slew of problems with the emulator, I counted myself extremely lucky if I could get it to boot up.

In the end, I installed it on one of my University's public computers, and it seemed to work great there. I think it's just touch-and-go based on your hardware. Do you have access to any other higher-end-ish machines you could try running the emulator on?
 
Upvote 0

ietv

Member
Licensed User
Longtime User
No idea. I had a whole slew of problems with the emulator, I counted myself extremely lucky if I could get it to boot up.

In the end, I installed it on one of my University's public computers, and it seemed to work great there. I think it's just touch-and-go based on your hardware. Do you have access to any other higher-end-ish machines you could try running the emulator on?

Unfortunately, no, just the one. I may just try to restart it with a clean slate.
 
Upvote 0

CidTek

Active Member
Licensed User
Longtime User
Hey ietv, I've actually been testing on the Playbook Simulator without importing into Eclipse. I use BlackBerry's online repackaging tool to turn B4A's created .apk files into .bar files, and then sideload those onto the simulator.

My process:
- Use the online repackager to convert the .apk to .bar. The .apk is in the "objects" folder of your project, and is generated when you hit compile/run. Link: https://bdsc.webapps.blackberry.com/android/bpaa/

- Use the blackberry-deploy command line tool to sideload the .bar onto the simulator. Instructions here: Package and deploy your application from the command line - Development Guide - BlackBerry WebWorks SDK for Tablet OS - 2.0

The blackberry-deploy utility comes with the various tablet SDKs. I got it by installing Adobe's Air SDK, and then BlackBerry's Tablet SDK for Adobe Air.

Let me know if you have questions!

I'm trying to port my B4a apk to the BB10 and as a first step I'm using the online packager which indicates as a second step it will help with the codesigning (I have a RIM cert). However as soon as I submit my apk file it says I have a critical problem with it not being signed which I thought is the step after the compatibility test. How do I get through the compatibility test?

Any ideas?
 
Upvote 0

TI994A

New Member
Hello everyone, and sorry to bump an old topic. I thought that it would be better than starting a new one.
During compilation Basic4android generates Java code. The code is available under the Objects subfolder.

You can copy the Java source code to a different folder and use it outside of Basic4android.

You will also need to reference Core.jar and BAShared.jar which are included in the installation.
Is the BAShared.jar essentially the B4A library that interprets the BASIC code?

If so, does it contain only the utilised functions, or the entire command library?

And lastly, does it add much bloat or compromise the speed of the final APK?

Thank you.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Is the BAShared.jar essentially the B4A library that interprets the BASIC code?
No. The B4A code is compiled to Java and then compiled to dalvik byte code.

B4AShared and Core libraries hold all kinds of helper methods (a thin framework).

Basic4android performance is the same as the performance of programs written with Java.
 
Upvote 0

TI994A

New Member
No. The B4A code is compiled to Java and then compiled to dalvik byte code.

B4AShared and Core libraries hold all kinds of helper methods (a thin framework).

Basic4android performance is the same as the performance of programs written with Java.
Hello, and thank you so much for answering personally. I apologise for such questions, but I am looking at your wonderfully powerful product as the potential development platform for my Android projects. And I'm asking because many RAD tools attach hefty runtimes that bloat the final executable, which can even affect performance.

When you say same as the performance of programs written with Java, do you mean speed-wise? Does B4A perform optimisations when generating the Java code from BASIC, especially in its interactions with the framework functions & methods?

And how does a typical B4A "Hello World" APK file compare to that compiled under Java/Eclipse? (a blank Android SDK application template compiled under Java/Eclipse is just under 200KB)

Once again, thank you.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
When you say same as the performance of programs written with Java, do you mean speed-wise?
Yes.

Does B4A perform optimisations when generating the Java code from BASIC, especially in its interactions with the framework functions & methods?
Basic4android type system is the same type system as Java. The result is that there are no losses in the conversion.

The size of a "Hello World" application is around 120kb.
 
Upvote 0

TI994A

New Member
Basic4android type system is the same type system as Java. The result is that there are no losses in the conversion.

The size of a "Hello World" application is around 120kb.
Hello again, and thank you for the answers.

You definitely weren't kidding; I downloaded the trial and built your "Welcome to Basic4android!" template, which included a message box, and the APK was just below 100KB! B4A seems to produce pretty tight code. Very impressive.

I'm pretty much sold; now to look for a discount code.

PS: Any chance your Basic4PPC might find new life in Windows Phone 8? :)
 
Upvote 0

mohdsaks

Member
Licensed User
Longtime User
Dear Mr. Erel,

Can you please help regarding a folder which is purely made in android how to import the files or java files to basic4android. thanks for the help in advanced.

Best Regards
 
Upvote 0
Top