Need help with PlatformLibrary sample

63 views
Skip to first unread message

MBethDev

unread,
Mar 25, 2010, 2:49:21 PM3/25/10
to android-porting
Hi,

Awhile back I wrote some customized code that modified the underlying
framework to perform some tasks I needed to do. Unfortunately, that
implementation was coupled and statically compiled with the rest of
the android framework code, which I soon learned was not supported
practice. I was then referred to the PlatformLibrary example to use
as an example for supporting customized framework code without having
to modify the android framework.

Now that I finally have some time to do this and refactor that code I
wrote a while back, I'm now looking at this sample. However, I think
I've spent way too much time trying to even get this to work and run
on the emulator. I've googled the groups for any answers, and even
though there are some references to it, I never got it to completely
work. I think I've pushed through the proper files to the emulator
(.so, .jar, .xml permissions file) yet everytime I do an adb install
on the PlatformLibraryClient I continue to get a
INSTALL_FAILED_SHARED_LIBRARY error. I even 'make clean' a couple of
times and tried to retrace my steps, but nothing worked! The only
thing I managed to work is having the client code recognize the APIs
from the PlatformLibrary class without throwing a compile error in
Eclipse.

Anyway, I hope this is not too much to ask, but if anyone out there
has gotten it to work, can someone post the correct steps on how to do
it from the moment we do a 'repo sync' on the branch, including what
make commands to invoke, what proper files to push to the emulator,
etc? I'm working on cupcake at the moment, and as I mentioned, I
started on a clean build first, it didn't work, then followed the
steps I've seen on the other group postings, that didn't work (pushing
the client on the emulator that is), redo everything using make clean,
etc.

Thanks. Really appreciate this. I hope someday soon these steps/
tutorial will be posted on the developer.android.com site.

MB


MBethDev

unread,
Mar 26, 2010, 4:50:53 PM3/26/10
to android-porting
Update (but it still doesn't work for me):

I logged into adb shell and verified the the xml file is under /system/
etc/permissions, the jar file in /system/framework, and the .so file
in /system/lib. I also verified the contents of the xml file and
under 'file' attribute, made sure its pointing to the correct .jar
path. In fact, here's a snippet of the xml now:

$ adb shell
# cat /system/etc/permissions/com.example.android.platform_library.xml
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<library name="com.example.android.platform_library"
file="/system/framework/
com.example.android.platform_library.jar"/>
</permissions>
# ls /system/framework/com.example.android.platform_library.jar
/system/framework/com.example.android.platform_library.jar
#

And this is what I got from logcat if I do an adb install or even
attempt to run from Eclipse:

D/ddm-heap( 402): Got feature list request
D/PackageParser( 64): Scanning package: /data/app/vmdl29153.tmp
E/PackageManager( 64): Package
com.example.android.platform_library.client requires unavailable
shared library com.example.android.platform_library; ignoring!
W/PackageManager( 64): Package couldn't be installed in /data/app/
com.example.android.platform_library.client.apk


Here is my AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
See the License for the specific language governing permissions
and
limitations under the License.
-->

<!-- This is an example of writing a client application for a custom
platform library. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.platform_library.client">

<application android:label="Platform Lib Client">

<!-- This tells the system about the custom library used by
the
application, so that it can be properly loaded and linked
to the app when the app is initialized. -->
<uses-library
android:name="com.example.android.platform_library" />

<activity android:name="Client">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category
android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>

As you can see, this is straight from the PlatformLibrary example. I
even got to the point where I started a fresh directory and I still
couldn't get it to work.

Any ideas.

MB

Reply all
Reply to author
Forward
0 new messages