Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Discussion > Android Lounge

Android Lounge A place for general Android discussion and questions.



Reply
 
LinkBack Thread Tools
Old July 10th, 2009, 03:05 AM   #1 (permalink)
Junior Member
 
Join Date: Jul 2009
Posts: 20
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Red face Include 3rd party code to APK

Below is my makefile. The generated APK file does include the classes from Third_party_2.5.jar, but not property files. The application does not work after the APK is loaded. Any suggestion?

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_STATIC_JAVA_LIBRARIES := libabc
LOCAL_MODULE_TAGS := eng development
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_PACKAGE_NAME := ABC_app
include $(BUILD_PACKAGE)
###############################
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := libabc:lib/Third_party_2.5.jar
include $(BUILD_MULTI_PREBUILT)
# Use the folloing include to make our test apk.
include $(call all-makefiles-under,$(LOCAL_PATH))

isup is offline  
Last edited by isup; July 14th, 2009 at 03:04 AM.
Reply With Quote
Sponsors
Old July 14th, 2009, 03:04 AM   #2 (permalink)
Junior Member
 
Join Date: Jul 2009
Posts: 20
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Found some similar post by google but no answer

Subject: 3rdPartyJar Files and property files Actions...
From: sasperilla (char...@gmail.com)
Date: Dec 29, 2007 8:29:37 am
List: com.googlegroups.android-developers
Hi,
I'm trying to add some 3rdparty apps to my android program, and the
jar files are added. However, inside this 3rdpartyjar file there is
a properties file seems to be missing when I run my app in the
emulator, and the 3rdparty code dies. I can run my program in a
Junit test as a normal java application and it works. How do I fix
this in the emulator?

Thanks in advance.
isup is offline  
Reply With Quote
Old July 14th, 2009, 03:05 AM   #3 (permalink)
Junior Member
 
Join Date: Jul 2009
Posts: 20
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Another similar post.

Subject: Accessing resources in 3rdpartyjar file Actions...
From: tauren (yowz...@gmail.com)
Date: Mar 29, 2008 12:50:24 pm
List: com.googlegroups.android-developers
It appears that it is not possible to access resources stored on the
classpath within a 3rdpartyjar file from Android. Many 3rdpartyjars store data and configuration files within the jar itself. I'm
surprised this doesn't work as it will prevent many 3rdparty
libraries from working without major overhauls. For instance, code
like the following doesn't work:
URL data = this.getClass().getResource(name);
I've read from other posts that the following doesn't work too:
Thread.currentThread().getContextClassLoader().get ResourceAsStream(resource);
I understand that jars get converted into dex files? When this
happens, are only class files retained? What happens to the
resources? Is there a way to access those resources?
Luckily, I have source for the jar file I need to use. Unfortunately,
it uses data resources all over the place, and probably 50% of the
classes will need to be modified. I'd much rather figure out a way to
access those resources without modifying all the code.
If this can't be solved, then any 3rdpartyjars that don't provide
source code could not be used in Android until the developer provides
an Android version of the jar. Is this just the way things work with
Android, or is there a workaround others have found?
Thanks!
Tauren
isup is offline  
Reply With Quote
Old July 14th, 2009, 03:06 AM   #4 (permalink)
Junior Member
 
Join Date: Jul 2009
Posts: 20
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This post says it is impossible.

Subject: [android-developers] Re: Embeded APK? Actions...
From: Mark Murphy (mmur...@commonsware.com)
Date: Dec 22, 2008 6:05:58 am
List: com.googlegroups.android-developers

Louis wrote:
Our product need provide some SDK to 3rdparty, and we want to provide
some services or activity in Android platform, spec for services. But
seems we can't provide it through the Jar files (Please let me know if
I am wrong ),

Sure you can!
Take your compiled Java classes and package them into a JAR, along with
instructions for what entries in AndroidManifest.xml your customers will
need to add to use your services and activities.

The only thing that does not work well this way is resources -- your JAR
cannot package resources
, nor can you reliably ensure that resources
will get the same resource IDs between your code and the actual Android
application. You can accept resource IDs as parameters, but you cannot
"bake in" your own resources. Or, rather, I have not figured out a trick
for doing this as yet.

I have a chapter in the upcoming _The Busy Coder's Guide to *Advanced*
Android Development_ that covers this. Fortunately, that is one of the
chapters already (partially) available, so current subscribers to the
Warescription can get access to this already.


And in these cases, is there any way to make our APK
as Embeded APK which 3rdparty can install it with their APK without
user more actions?

I do not believe this is possible.
--
Mark Murphy (a Commons Guy)
CommonsWare: Helping the Commons, One Bit at a Time
_The Busy Coder's Guide to Android Development_ Version 1.9 Available!
isup is offline  
Reply With Quote
Old July 14th, 2009, 03:08 AM   #5 (permalink)
Junior Member
 
Join Date: Jul 2009
Posts: 20
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Any commnet? Why can Eclipse do it but command line "make" not?
isup is offline  
Reply With Quote
Reply

Bookmarks


Go Back   Android Forums > Android Discussion > Android Lounge User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
In Need of a translator CMD code to Terminal code for board sticky of Side loading apps. vapor311 Samsung Captivate 1 September 1st, 2010 10:57 PM
what does htc sense ui include ItsMyDesire HTC Desire 4 June 25th, 2010 02:15 PM
Trade My demonoid invitation code for your Google voice code igot5onitt Non-Android Listings 6 June 13th, 2010 03:58 PM
2.1 Hero upgrades ... what does it include? TeamPEZ HTC Hero 38 March 30th, 2010 05:06 PM
Include 3rd party code to APK isup Application Development 1 July 10th, 2009 03:00 AM



All times are GMT -5. The time now is 05:18 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo