Adding prebuilt APK fails

Showing 1-12 of 12 messages
Adding prebuilt APK fails Tiago Vieira 6/4/10 12:19 PM
Hi everyone, it's my first email to this group.

I'm building Android from source. I'm using all applications already in generic.mk and product.mk within the build folder. I'm also adding some prebuilt APKs following the Prebuilt cookbook on the Open Source website.

One example is Facebook. I extracted the Facebook.apk from the Marketplace. If I install this app through 'adb install' it works ok. But when I build with this apk added into the build, it doesn't work. I've done the samething for Twitter and it worked fine.

This is a piece of the logcat:

W/PackageManager(   89): Exception reading apk: /system/app/AndroidFacebook.apk
W/PackageManager(   89): java.io.IOException: /system/app/AndroidFacebook.apk
W/PackageManager(   89):         at dalvik.system.DexFile.isDexOptNeeded(Native Method)
W/PackageManager(   89):         at com.android.server.PackageManagerService.performDexOptLI(PackageManagerService.java:2153)
W/PackageManager(   89):         at com.android.server.PackageManagerService.performDexOpt(PackageManagerService.java:2139)
W/PackageManager(   89):         at com.android.server.am.ActivityManagerService.ensurePackageDexOpt(ActivityManagerService.java:1750)
W/PackageManager(   89):         at com.android.server.am.ActivityManagerService.generateApplicationProvidersLocked(ActivityManagerService.java:7818)
W/PackageManager(   89):         at com.android.server.am.ActivityManagerService.attachApplicationLocked(ActivityManagerService.java:5513)
W/PackageManager(   89):         at com.android.server.am.ActivityManagerService.attachApplication(ActivityManagerService.java:5673)
W/PackageManager(   89):         at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:311)
W/PackageManager(   89):         at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1552)
W/PackageManager(   89):         at android.os.Binder.execTransact(Binder.java:287)
W/PackageManager(   89):         at dalvik.system.NativeStart.run(Native Method)


Any idea why the app doesn't work when I add a prebuilt APK into the build but it works ok when I install via adb?

Thanks in advance,

Tiago

Re: Adding prebuilt APK fails FrankG 6/7/10 12:59 AM
Hi Tiago,

I don't know the Prebuilt cookbook ( can you give me a pointer ?),
so I have no idea how you Build-File looks like.

Nevertheless I have good success with kind of Android.mk File :

LOCAL_MODULE := <YourAppName>
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)

include $(BUILD_PREBUILT)

The special thing is IMHO the "include $(BUILD_PREBUILT)".

Good luck !

  Frank




On 4 Jun., 21:19, Tiago Vieira <ti...@tvieira.com> wrote:
> Hi everyone, it's my first email to this group.
>
> I'm building Android from source. I'm using all applications already in generic.mk and product.mk within the build folder. I'm also adding some prebuilt APKs following the Prebuilt cookbook on the Open Source website.
>
> One example is Facebook. I extracted the Facebook.apk from the Marketplace. If I install this app through 'adb install' it works ok. But when I build with this apk added into the build, it doesn't work. I've done the samething for Twitter and it worked fine.
>
> This is a piece of the logcat:
>
> W/PackageManager(   89): Exception reading apk: /system/app/AndroidFacebook.apk
> W/PackageManager(   89): java.io.IOException: /system/app/AndroidFacebook.apk
> W/PackageManager(   89):        at dalvik.system.DexFile.isDexOptNeeded(Native Method)
> W/PackageManager(   89):        at com.android.server.PackageManagerService.performDexOptLI(PackageManagerServ­ice.java:2153)
> W/PackageManager(   89):        at com.android.server.PackageManagerService.performDexOpt(PackageManagerServic­e.java:2139)
> W/PackageManager(   89):        at com.android.server.am.ActivityManagerService.ensurePackageDexOpt(ActivityMa­nagerService.java:1750)
> W/PackageManager(   89):        at com.android.server.am.ActivityManagerService.generateApplicationProvidersLo­cked(ActivityManagerService.java:7818)
> W/PackageManager(   89):        at com.android.server.am.ActivityManagerService.attachApplicationLocked(Activi­tyManagerService.java:5513)
> W/PackageManager(   89):        at com.android.server.am.ActivityManagerService.attachApplication(ActivityMana­gerService.java:5673)
> W/PackageManager(   89):        at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:311­)
> W/PackageManager(   89):        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerServ­ice.java:1552)
Re: Adding prebuilt APK fails nguyenvuthiennga 6/8/10 12:47 AM
Hi,

I also tried to add pre-built apk. I follows the instructions from
this link

http://source.android.com/porting/build_cookbook.html

Compiling gives no error but I don't see my package in installed-
files.txt as well as in the launcher.

Does anyone have a hint?

Thanks in advance,

Nga
Re: Adding prebuilt APK fails FrankG 6/8/10 12:59 AM
I assume that in your case it is the missing entry
in app/mydroid/build/target/product/generic.mk

Good luck !

  Frank
> > > Tiago- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -
Re: Adding prebuilt APK fails Pavan Savoy 6/8/10 2:21 AM
Wonder why the "mm" command installs the .apk but not the top level
make -j2 command.
Is there a vendor specific file - where I can mention the same ? i.e
list of apps to be installed like the build/target/product/core.mk ?

> --
> You received this message because you are subscribed to the Google Groups "android-platform" group.
> To post to this group, send email to android-...@googlegroups.com.
> To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.
>
>

--
--Pavan Savoy

Re: Adding prebuilt APK fails nguyenvuthiennga 6/8/10 5:08 AM
Hi Frank,

Actually, I added the entry in vendor/aosp/products/aosp_core.mk

I did the same with my applications and it works.

Is there difference between mk files in build/target/product and
vendor/aosp/products?

Nga


On Jun 8, 11:21 am, Pavan Savoy <pavan.sa...@gmail.com> wrote:
> Wonder why the "mm" command installs the .apk but not the top level
> make -j2 command.
> Is there a vendor specific file - where I can mention the same ? i.e
> list of apps to be installed like the build/target/product/core.mk ?
>
>
>
Re: Adding prebuilt APK fails FrankG 6/8/10 6:16 AM
Hello Nga,

I don't know. I simply saw that the other vendor extensions APKs from
app/mydroid/vendor also put into generic.mk.

Good luck !

 Frank
> > --Pavan Savoy- Zitierten Text ausblenden -
Re: Adding prebuilt APK fails Tiago Vieira 6/21/10 8:35 AM
Hi all

I solved the problem. When I install an APK via adb, the process extracts the libraries from the APK and copy it to some folder which is visible by the application itself.

The problem was when I add an APK through the prebuilt process, the .so library needed by the app was not being extracted (actually there is no "installation process", it is just copying files across) .

What I've done was finding through the logcat what .so was extracted for the particular APK during adb installation. Then I pull the file out from the handset and add into the Android.mk like:

include $(CLEAR_VARS)
LOCAL_MODULE := lib.so
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
LOCAL_SRC_FILES := libs/$(LOCAL_MODULE)
OVERRIDE_BUILT_MODULE_PATH := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)
include $(BUILD_PREBUILT)

That library is now going into a shared place and the application starts correctly. I had to do that for 3 or 4 APK I've been built as preloaded app.

I wouldn't change any file within the build directory as it can be overwritten in a future release and you are going to have lots of headaches in a future. Keep your changes within vendor directory as per Google's documentation on the PDK website.

Regards,
Tiago

Re: Adding prebuilt APK fails FrankG 6/22/10 6:41 AM
Hello Tiago,

thanks for your update.

But your original stacktrace is strange and misleading. I think nearly
everyone who add a prebuild app with some ndk stuff know this problem,
but normaly the error
indicates that the app is searching under /system/lib for his shared
library. But I your case their was no indication for this ?

Nevertheless nice if is solved know for you.

Best regards !

  Frank
> > For more options, visit this group athttp://groups.google.com/group/android-platform?hl=en.- Zitierten Text ausblenden -
Re: Adding prebuilt APK fails Tiago Vieira 6/22/10 6:55 AM
Hi Frank

When I installed those apks via adb I found their libraries in /data/data/<packagename>/lib folder.

This looks a place where the apk shares libraries to itself. That would be OK if the library goes to that place during a prebuilt, which is not the case. The library just doesn't come out of the apk.
So, adding the extracted library into the shared libraries folder worked (and, yes, I think that is a bit dirty way to do this... :-) ).

I'm new to the Android build system, so that was the way it was solved for the moment. But, it would be good to know what would be the best practice in this case. It is difficult to find more information about the Android Build System apart from what the PDK site has.

Best regards,

Tiago

Re: Adding prebuilt APK fails FrankG 6/23/10 7:57 AM
Hello Tiage,

I have a simliar makefile ( without OVERRIDE_BUILT_MODULE_PATH := $
(TARGET_OUT_INTERMEDIATE_LIBRARIES) )
and with them the Shared Libraries are put in the generated system
image under /system/lib.

Good luck !

Frank
> >>> For more options, visit this group athttp://groups.google.com/group/android-platform?hl=en.-Zitierten Text ausblenden -
Re: Adding prebuilt APK fails Dianne Hackborn 6/23/10 9:42 AM
The mm and mmm commands are short-cuts for use during rapid iteration of development to build specific targets without doing the full dependency tracking or product resolution.  They thus can behave is slightly different ways from a regular make.Dianne Hackborn
Android framework engineer
hac...@android.com

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