How to create shared source folder across multiple projects in Eclipse? - android

I've been looking at the Android + App Engine source code from a Google IO session (Android meet App Engine). They generate three projects, an Android project, a GWT interface, and an App Engine server project. All of these projects have a common source folder called shared where they can put their synchronized data classes that all parts of the app need to know about.
I'm wondering how to create that shared source folder in a general Eclipse project. How can I create a source folder in one project that's also available to and synced with other projects in Eclipse?
Edit
I'm not looking for how to do an Android Library project (I already use several of those for my apps). Android Libraries don't work for a general eclipse project, say an App Engine server side project.

I am using Helios eclipse.
To create Source Folder
Navigate to your project in the package Explorer, right-click and select New, select Source Folder. Enter the folder name and click Finish.
If you want to use the source folder in any of your projects, then go to your project properties, click Java Build Path, go to Source tab, you can link the folder.

The way to do this within Android is through use of a library project. Create one project as an Android library (properties->android->Is Library gets checked), and the others must have their property page updated to make use of the library.
Libraries have their code and resources pulled into projects that use the library. The library's manifest is ignored.

Related

How to create a SDK on Android?

I developed an Android app with Android Studio and I want now to create a SDK to enable other developer to use the technology I created. This SDK should use an activity and a couple of background service.
I've looked around on internet and on SO, but I did not manage to find the basic information I need :
How to set Android Studio to build a SDK , not an APK;
Is there any security to implement so that my code is not readable by others?
I created an app but I have no basic knowledge on building SDK, so any information or link where I can learn would be appreciated.
According to me what you require is a .aar file. Just like you give out Java sdk's as a jar, you can package your Android code as a .aar file. This can be imported in any other Android project and your exposed API's / screens can be used directly.
To create an aar select your module in Android studio project structure- then on the right pane select gradle and then select generate .aar file. This will be generated in your build/outputs folder.
Now this can be added in any project and compiled by putting a dependency in the gradle. You can Google "creating an aar" for more information.

Unable to find package com.google.cast

I recently updated ADT to point to Google APIs 18. The install went fine it seems and I'm able to point my Project Properties to Google APIs 18, however, Eclipse can't find the package com.google.cast. Anyone else having this problem?
That's because com.google.cast is not part of Android.
Near as I can tell, you will need to download a ZIP file containing their library project, import it into your IDE, mark it as actually being a library project, then attach that library project to your app.
Actually using those APIs appears to require a whitelisting, and it is in violation of their license to actually distribute an app (or, near as I can tell, source code) without express written permission of Google.
CommonsWare is correct, additionally, you'll need the v18 Android Support Libraries. v7/mediaRouter & v7/appCompat
I finally got this to work for me. Originally, I tried doing it like I used ActionBarSherlock (making it a library, went to Project -> Properties and told it to use that library, etc) but that didn't work. Finally, I got frustrated and simply moved the GoogleCastSdkAndroid-1.0.0.jar file from the lib folder of the library directly into the lib folder of the project.
So, again, I imported from existing code the SDK into my workspace, then took the jar file from its library and put it directly into my project's lib folder. Not sure if that's how it's supposed to be, but the sample TicTacToe game is now error free and runs on my Nexus 4.
It sounds like you're trying to run one of the Google Cast sample apps without having installed the Google Cast SDK. The instructions for installing the SDK and all necessary support libraries were just uploaded here on GitHub. I'm quoting below the relevant section for installing the Cast SDK itself:
http://developer.android.com/tools/support-library/setup.html#libs-with-res
You can either add the Cast SDK as a library project in your workspace, or add
the GoogleCastSdkAndroid-x.x.x.jar directly to the project you're building. The
former is recommended if you have multiple Cast-related projects in your
workspace.
As a library project: Follow the Support Library setup instructions linked
above for your downloaded and extracted SDK.
As an included library:
Copy the /libs folder from your downloaded SDK to your Cast-related project.
In the Package Explorer window, open (your Cast project)/libs and right
click on GoogleCastSdkAndroid-x.x.x.jar. Select Build Path->Add to Build
Path.

IBM Worklight - How to make Android environment code "independent" from the generated project?

When I build a Worklight project that also has the Android environment, a separate Android project is generated. That's fine.
If I add any files to the native folder of the Android environment which is residing in the Worklight project, those changes are getting replicated in the generated Android project. But, if I delete the generated project completely (for whatever reason), all the modifications that I've done in Worklight Android environment are lost (native folder is getting deleted).
Should that happen like that? Or is there any other approach have I to follow?
When deleting the generated Android project make sure that you choose to not delete the project resources from disk.
Note that changes done in the native folder should be of specific nature, that is:
change native resources (icons, images, ... for this we have the nativeResources folder)
native code
Any other modifications should most probably be done in the common or android folders rather than the android\native folder.
Delete androidtestTestappAndroid
Make sure the checkbox is not ticked

android & libgdx - how to use resources only once for both desktop and android projects?

i'm a little new to libgdx library (opengl wrapper library) under android .
i've noticed that the examples have the same resources files (images) on both the desktop and android projects.
is there a way to have those files reside on one project (even an additional ,library project) so that both the android and the desktop projects will use it?
maybe have a linking of resources of some kind?
in short, does anyone know of the best practice of this problem?
could libgdx even handle any folder that is not in the assets folder of an android project?
ok , the sortest answer i got is that , assuming that both desktop and android projects are on the same folder :
go to the desktop project ->java build path->source -> linked source ->path variables-> put "PARENT-1-PROJECT_LOC/ANDROID_PROJECT_FOLDER/assets" .
and then , from now on , put the assets files only inside the android project.
This article on libGDX wiki is helpful regarding your question:
LibGDX Project Setup.
Check the part Asset folder setup.

IntelliJ and Android SDK sample projects

Can IntelliJ use an Android SDK sample project as a base when creating a new project? So far, I haven't been able to import source codes from the default directory (/samples/android-<level>/project_name) and I had to copy the source files manually into a newly-created project.
Any faster way?
You can choose to create project from existing sources. Here is official documentation. If I understand correctly what do you mean. However if you want to use some project as a template then this will not suit you.

Categories

Resources