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.
Related
How to download the android project from android.googlesourece.com with the Gradle file!! I want to download the DeskClock app
https://android.googlesource.com/platform/packages/apps/DeskClock/+/refs/tags/android-r-preview-2
but the project does not contain the Gradle file, also I did go through the official documentation but I don't really understand well. is there a tutorial guys, can you guys guide me how to get the files with Gradle
These apps are part of AOSP build tree. There are no Gradle files for them. The information on how it is build, what its dependencies are is inside Android.mk (or Android.bp for newer versions) .
To build a such app, you'll have to download the whole AOSP tree, setup the environment, and then you can build a single module using mmm packages/apps/DeskClock.
You could always try to import it in Android Studio, and see if that works.
Apps in the AOSP tree often use non standard SDKs ( methods and classes that aren't part of official SDK that you get when developing Android apps).
It's generally difficult to build them out-of-tree like this. This might be of help for some references https://github.com/anggrayudi/android-hidden-api.
I want to use an android library in Unity. The library contains a service which delivers some content to consume in your app. For native android apps (apps programmed using java), this content can be easily received by extending the library's service in the application. But I want to use this service (in fact the content that this service provides) in a Unity application. Can anyone explain how to do this?
First you can't use .aar library files inside unity because the new format for Android Archives (.aar) is integrated with the new Gradle build system, however, Unity does not use that when building the project for Android yet.
So , you can compile your .aar file , extract it, and use the classes.jar to access the java classes inside the project you have. ( I've used this method when I converted from Eclipse to Android Studio ).
You need to create a plugin. Export android project from unity that can be opened in eclipse or Android Studio. Write the code there. Unity has document here that will help you in communication between unity and native android.
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.
I would like to test my library in an android application, but I would like to avoid compiling and moving around .jar files.
In Xcode for iOs development, it's possible to add your library project in your workspace inside your other project (a test app) and when you run your test app, it builds the library and links everything up correctly.
Can I do this for Android development in Eclipse? How can I do this?
I tried to add a library but it seemed very manual which isn't ideal on time.
The important thing here is that I do have Android references and dependancies, so i can't just unit test the library by itself. I am also creating an SQLite database which I would like to inspect during development.
I guess you are asking about Android Library projects, otherwise you can just test your library using JUnit.
In such case, the post android: testing library projects gives you a step by step guide on how to proceed to test the Android Library project in a stand-alone fashion. Think it can also be tested through the tests belonging to the Android project that uses the library.
You can test your library code using RoboElectric that allows you to test without the need of deploying an android emulator.
Or you can set your library project as an Android library project and put the test in the first project. link
In latest android SDK tools you do not need to add jar in build path, they will be added automatically.
you can put you jar file in libs folder of your project, But it will defiantly be compile before running.
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.