Using JNI to call C lib on android platform

by Dianne Hackborn » Wed, 04 Feb 2009 12:09:19 GMT


Sponsored Links
 That API is part of the SDK, but native code is not a part of the SDK, so it
probably won't do you much good.







-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~---------~--~----~------------~-------~--~----~



Using JNI to call C lib on android platform

by Jerry Yang » Wed, 04 Feb 2009 12:35:29 GMT


 Hi, Dianne

I also see some declaration that says the native code is not supported
in current SDK.

 

I am a little bit confused.

So is this API can work for loading a C written library? That means the
android java platform can use the function implied in the library( .so
cross-compiled by arm based GCC), is that right?

Maybe my conception is not correct, but what is the exact meaning of
"Native code support"? is it means the JNI or anything else?

 

Thanks

With best wishes

Jerry 

 

From: android-developers@googlegroups.com
[mailto:android-develop...@googlegroups.com] On Behalf Of Dianne
Hackborn
Sent: Wednesday, February 04, 2009 12:09 PM
To: android-developers@googlegroups.com
Subject: [android-developers] Re: [android-developers]Using JNI to call
C lib on android platform

 

That API is part of the SDK, but native code is not a part of the SDK,
so it probably won't do you much good.

On Tue, Feb 3, 2009 at 7:41 PM, Jerry Yang <jer...@intertrust.com>



Hi, Dianne

I find an api with the name "java.lang.System.loadLibrary
< http://code.google.com/android/reference/java/lang/System.html #loadLibr
ary%28java.lang.String%29> "

Is this api not supported in Android SDK now?

Thanks

With best wishes

Jerry

 

From: android-developers@googlegroups.com
[mailto:android-develop...@googlegroups.com] On Behalf Of Dianne
Hackborn
Sent: Wednesday, February 04, 2009 11:25 AM
To: android-developers@googlegroups.com
Subject: [android-developers] Re: [android-developers]Using JNI to call
C lib on android platform

 

Sorry, native code is not currently supported in the SDK.

On Tue, Feb 3, 2009 at 6:27 PM, Jerry Yang <jer...@intertrust.com>



Hi, all

Does anyone have any information about using the external C written lib?

I have a C lib(no user interface, can be compiled like dll or lib) that
need to be used in the app, but I cannot find any document in android
SDK about how to use the external lib.

 

My idea is: I should cross-compile the lib with arm based detain GCC and
use the interface to Android app. Any one has any document or example
about this?

Appreciate for your help!

 

With best wishes

Jerry Yang

 

 

 

 




-- 

Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.



 

 




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.




--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Using JNI to call C lib on android platform

by Dianne Hackborn » Wed, 04 Feb 2009 12:56:01 GMT


 t means that the SDK does not include support for native ARM code.
Figuring out tricks to use it is just like working around the SDK to use
some other unsupported API: you will most likely break at some point in the
future when your users receive an OTA update that changes the API you are
using. In this case, the API is the entire set of APIs for native code: the
calling conventions, posix and c library, etc.

Sorry but that is all I have time to post on this topic. You can do a
search on the group to find numerous other discussions on it.

On Tue, Feb 3, 2009 at 8:35 PM, Jerry Yang <jer...@intertrust.com> wrote:



--
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support. All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Amazon Market - First red flag

I posted a question previously asking what people thought about the Amazon 
Market.  I uploaded the free and premium versions of one of my apps just to 
give it a whirl...can't hurt, right?

My app was rejected, and for what I believe to be a ridiculous reason, and 
it gives me a really bad first impression of their market.  I have an info 
section on the app in both versions where I have a few text links promoting 
myself (Twitter, Facebook page for my app, etc).  One of these links is my 
market url (*market*://search?q=*pub*: etc).  They cited this as the reason 
for rejecting my apps.

Quote:
Per a published change to our policy, your app has failed an Installation 
test case. Linking to Your App: When pointing to other apps from within your 
app, including up-sells, completion of purchase must be from the Amazon.com 
app store (unless the app is not eligible for listing in our store). 

This is really really lame and very anti-Android in my opinion.  Instead of 
forcing me, the developer, to recompile my app specifically for them, why 
don't they just ADD A FREAKIN INTENT FILTER FOR MARKET URL'S!?!?!?!?!?!?!?! 
 lol.  Dude...Android 101.

Anyone else have any experience now that enough time has lapsed to be 
approved/rejected? 

-- 
.

2. Can't get android sources

I'm trying to get android-2.2-froyo sources using described procedure:
repo init -u git://android.git.kernel.org/platform/manifest.git -b
froyo

but always get an error:
"error: revision froyo in manifests not found"

What is the matter ?

-- 

3. Regarding emulator.exe has encountered a problem and needs to close. We are sorry for the inconvenience.

4. How to configure kernel?

5. Huawei IDEOS C8150 Android - AHAtouch Dari Bakrie Telecom

6. Building Mac SDK in Ubuntu

7. interfacing to a server via http with a service