Re: [android-developers] Accessing APK expansion file with URI (with Google Zip Expansion Library) causes a crash if expansion file version is different from apk versioncode

2012-11-22 Thread bhaskar bommala
Hi

I am trying to upload images (i have packed all images in to zip)as apk
main expansion files and added apk expansion library and downloaded library
to my application but when am trying to run app am getting exception like
the following...
Note: I have copied properly the PBKey from my publisher account.


11-21 18:24:48.084: E/AndroidRuntime(21220): FATAL EXCEPTION: main
11-21 18:24:48.084: E/AndroidRuntime(21220):
java.lang.IllegalArgumentException: salt.length == 0
11-21 18:24:48.084: E/AndroidRuntime(21220): at
javax.crypto.spec.PBEKeySpec.init(PBEKeySpec.java:79)
11-21 18:24:48.084: E/AndroidRuntime(21220): at
com.google.android.vending.licensing.AESObfuscator.init(AESObfuscator.java:59)
11-21 18:24:48.084: E/AndroidRuntime(21220): at
com.google.android.vending.expansion.downloader.impl.DownloaderService$LVLRunnable.run(DownloaderService.java:754)


Can anyone help me out ,if provide sample that would be great.


On Sat, Apr 7, 2012 at 10:50 PM, sk sk.h...@gmail.com wrote:

 My apk version code is version 3. with it I am using main expansion
 file which was loaded with apk version code 1 (file name is similar to
 main.1.ex.etc.eg.obb). The expansion file downloads fine on a device.

 The expansion file has media file, so I using APEZProvider from the
 Google Zip Expansion Library to play it with VideoView.

 Calling VideoView.start() causes an Nullpointer exception.

 What I have found so far: In APEZProvider.initIfNecessary() returns
 Main expansion file version as 3 instead of 1. Thus trying to open
 ZipResourceFile (mAPKExtensionFile) returns null.
 APEZProvider.openAssetFile() causes null pinter exception as
 mAPKExtensionFile is null.

 Relevant code from APEZProvider class in Google Zip Expansion Library:


 private boolean initIfNecessary() {
 if ( !mInit ) {
 Context ctx = getContext();
 PackageManager pm = ctx.getPackageManager();
 ProviderInfo pi = pm.resolveContentProvider(getAuthority(),
 PackageManager.GET_META_DATA);
 PackageInfo packInfo;
 try {
 packInfo = pm.getPackageInfo(ctx.getPackageName(), 0);
 } catch (NameNotFoundException e1) {
 e1.printStackTrace();
 return false;
 }
 int patchFileVersion;
 int mainFileVersion;
 int appVersionCode = packInfo.versionCode;
 if ( null != pi.metaData ) {
 mainFileVersion = pi.metaData.getInt(mainVersion,
 appVersionCode);
 patchFileVersion = pi.metaData.getInt(patchVersion,
 appVersionCode);
 } else {
 mainFileVersion = patchFileVersion = appVersionCode;
 }
 try {
 mAPKExtensionFile =
 APKExpansionSupport.getAPKExpansionZipFile(ctx, mainFileVersion,
 patchFileVersion);
 return true;
 } catch (IOException e) {
 e.printStackTrace();
 }
 }
 return false;
 }


 @Override
 public AssetFileDescriptor openAssetFile(Uri uri, String mode)
 throws FileNotFoundException {
 initIfNecessary();
 String path = uri.getEncodedPath();
 if ( path.startsWith(/) ) {
 path = path.substring(1);
 }
 return mAPKExtensionFile.getAssetFileDescriptor(path);
 }


 I am not sure about this line of code in the above: ProviderInfo pi =
 pm.resolveContentProvider(getAuthority(),
 PackageManager.GET_META_DATA); Is this correct?

 From Android reference for PackageManager.resolveContentProvider().

 public abstract ProviderInfo resolveContentProvider (String name, int
 flags)

 Since: API Level 1 Find a single content provider by its base path
 name. Parameters

 name The name of the provider to find. flags Additional option flags.
 Currently should always be 0.

 Can someone confirm if i am doing something wrong or is it a bug.

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

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

[android-developers] Accessing APK expansion file with URI (with Google Zip Expansion Library) causes a crash if expansion file version is different from apk versioncode

2012-04-10 Thread sk
My apk version code is version 3. with it I am using main expansion
file which was loaded with apk version code 1 (file name is similar to
main.1.ex.etc.eg.obb). The expansion file downloads fine on a device.

The expansion file has media file, so I using APEZProvider from the
Google Zip Expansion Library to play it with VideoView.

Calling VideoView.start() causes an Nullpointer exception.

What I have found so far: In APEZProvider.initIfNecessary() returns
Main expansion file version as 3 instead of 1. Thus trying to open
ZipResourceFile (mAPKExtensionFile) returns null.
APEZProvider.openAssetFile() causes null pinter exception as
mAPKExtensionFile is null.

Relevant code from APEZProvider class in Google Zip Expansion Library:


private boolean initIfNecessary() {
if ( !mInit ) {
Context ctx = getContext();
PackageManager pm = ctx.getPackageManager();
ProviderInfo pi = pm.resolveContentProvider(getAuthority(),
PackageManager.GET_META_DATA);
PackageInfo packInfo;
try {
packInfo = pm.getPackageInfo(ctx.getPackageName(), 0);
} catch (NameNotFoundException e1) {
e1.printStackTrace();
return false;
}
int patchFileVersion;
int mainFileVersion;
int appVersionCode = packInfo.versionCode;
if ( null != pi.metaData ) {
mainFileVersion = pi.metaData.getInt(mainVersion,
appVersionCode);
patchFileVersion = pi.metaData.getInt(patchVersion,
appVersionCode);
} else {
mainFileVersion = patchFileVersion = appVersionCode;
}
try {
mAPKExtensionFile =
APKExpansionSupport.getAPKExpansionZipFile(ctx, mainFileVersion,
patchFileVersion);
return true;
} catch (IOException e) {
e.printStackTrace();
}
}
return false;
}


@Override
public AssetFileDescriptor openAssetFile(Uri uri, String mode)
throws FileNotFoundException {
initIfNecessary();
String path = uri.getEncodedPath();
if ( path.startsWith(/) ) {
path = path.substring(1);
}
return mAPKExtensionFile.getAssetFileDescriptor(path);
}


I am not sure about this line of code in the above: ProviderInfo pi =
pm.resolveContentProvider(getAuthority(),
PackageManager.GET_META_DATA); Is this correct?

From Android reference for PackageManager.resolveContentProvider().

public abstract ProviderInfo resolveContentProvider (String name, int
flags)

Since: API Level 1 Find a single content provider by its base path
name. Parameters

name The name of the provider to find. flags Additional option flags.
Currently should always be 0.

Can someone confirm if i am doing something wrong or is it a bug.

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