Can not read apk file on android emulator - SDK 1.1

by danielececil...@gmail.com » Thu, 30 Apr 2009 02:05:56 GMT


Sponsored Links
 Hi,

It seems my code cannot read an apk File I have created on the Android
emulator.

- First off, I created an sdcard with command 'mksdcard ...'
- then I run this code:

------------- Begin Cut Here --------------->

File tmpdir = new File(tmpdirpath+name);

if (!tmpdir.exists())
 {
  boolean b = tmpdir.mkdirs();
 }
else
 {
  if (!tmpdir.isDirectory())
  {
   throw new RuntimeException("here : the tmp dir conflicts");
  }
 }
File apk = new File(tmpdirpath + name + "/" + name + ".apk");
if (!apk.exists())
 {
  apk.createNewFile();
 }
// with name = name of my apk file.

------------- End Cut Here --------------->

- The apk file is successfully created on a temporary directory on /
sdcard,
but I have no permissions to read it:

- - - - r w - r w -

- I tryed to change them:
# adb shell
# chmod 777 myFile.apk

No error but permissions remain the same

- - - - r w - r w -

and I get the following exception:
        04-28 14:56:16.296: ERROR/dalvikvm(231): Can't open dex cache '/data/
        dalvik-cache/
        
sdc...@.tmpdir@org.python.pycode._p...@org.python.pycode._pyx0.apk@classes.dex':
        No such file or directory
        04-28 14:56:16.296: INFO/dalvikvm(231): Unable to open or create
cache
        for /sdcard/.tmpdir/org.python.pycode._pyx0/
        org.python.pycode._pyx0.apk
        04-28 14:56:16.306: WARN/System.err(231): java.io.IOException: unable
        to open DEX file
        04-28 14:56:16.326: WARN/System.err(231):     at
        dalvik.system.DexFile.openDexFile(Native Method)
        04-28 14:56:16.336: WARN/System.err(231):     at
        dalvik.system.DexFile.<init>(DexFile.java:55)
        04-28 14:56:16.346: WARN/System.err(231):     at
        dalvik.system.DexFile.<init>(DexFile.java:41)
        04-28 14:56:16.355: WARN/System.err(231):     at
        org.python.debug.FixMe.getClassByName(FixMe.java:93)


Can somebody help please?


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



Other Threads

1. Speed issue: content provider vs plain sqlite db

Hi there,

I have made an app that makes extensive use of an internal sqlite db
to save news feeds. Those feeds are parsed from an URL and then cached
in the DB so that I'm able to re-add them to a ListView after a
onPause()/onResume() pair. It's all quite nice but it takes about 2 or
3 seconds to restore the feed and showup the filled ListView.

Apart from 1 ListView it's actually a TabHost with 3 ListActivities
and in each of their ListView's I got about 50 items. So I can not not
hold all 150 items at once in memory. That's the reason I cache them
to a DB so I'm able to clear them out in their onPause() call.

Why is it so slow? Would it be better to implement a ContentProvider?
And, would it really speed the app up?

Thanks in advanced.

Cheers,
  Moss

-- 

2. Alarm Clock Localization query

Hi All ,

I am bit confused about location stuff in Alarm clock application in Eclair
2.1  . I want to confirm if its a feature or a bug .
1 . Click on Main Menu -> Alarm Clock ->(Any Set Alarm)->Repeat . This pops
up list of all weekdays from Monday to Sunday along with check button so as
to enable them for corresponding alarm .
2. Now select Dutch(Netherland language)
Click on Main Menu->Settings-> Language & Keyboard-> Select Locale->Dutch
(Netherlands)
This will install Dutch environment in Android .
3. Click on Main Menu -> Alarm Clock(Wekker) ->(Any Set Alarm)->
Herhalen(Repeat) . This will show list of index for week days . rather than
this dutch version of weekdays (Mon to Sun) should list out .

Concern source code for fetching weekdays is in Alarms.java file under :
ANDROID_TOP/packages/apps/AlarmClock/src/com/android/alarmclock


for (int i = 0; i < 7; i++) {
                if ((mDays & (1 << i)) != 0) {

                    ret.append(dayList[DAY_MAP[i]]);
                    dayCount -= 1;
                    if (dayCount > 0) ret.append(
                            context.getText(R.string.day_concat));
                }
            }

Other localization strings are in strings.xml file under
ANDROID_TOP/packages/apps/AlarmClock/res/values-*/

Does it like to have only indexes 0,1,2,,,instead of translated strings for
Mon,Tues,... in Dutch etc languages for Alarm Clock ??

Any Help would be appreciated .




Thanks :
Uander

-- 

3. View files within package data

4. Multitouch API question

5. Enabling Pattern lock without a set pattern

6. Update/alter Android Preferences dynamicaly

7. How to bring activity to front?