- I want to read myself apk file size in JNI of NDK,my C code is follow:
 - if (bflag==0){
 - FILE* fp;
 - fp=fopen( "/data/app/ziwu.ziwu.ziwu.apk", "r");
 - fseek(fp,0,SEEK_END );
 - int size=ftell(fp);
 - if (size>183650&&size<193750)
 - {
 - bflag=1;
 - }else{
 - return (*env)->NewStringUTF(env, www2);
 - }
 - }
 - this code in emulator2.1 run OK,but in real phone run not OK.
 - how to access /data/app/my.apk on Android for JNI of NDK of normal App?
 - I am a chinese,my English is not very good.
 - i get my apk file size in NDK,so nobody can decompiler my java code to change my
 - apk file size.
 - Does emulator always have root permission?Otherwise why different from emulator
 - and real phone?
 
            Asked
            
        
        
            Active
            
        
            Viewed 1,374 times
        
    0
            
            
        
        user1234613
        
- 1
 - 2
 
- 
                    you can do this using java follow this http://stackoverflow.com/a/2605838/1075066 – Its not blank Feb 27 '12 at 03:34
 - 
                    I do not want to use java,I want to use C,use JNI,use NDK. – user1234613 Feb 27 '12 at 04:18
 - 
                    because i do not want anyone counter compile my java code,so i use ndk – user1234613 Feb 27 '12 at 04:26
 - 
                    counter compile mean decompiler?i am chinese,my english is not very good – user1234613 Feb 27 '12 at 04:29
 - 
                    i do not understand the sentence "Though I cannot access /data/app, but I can access /data/app/SoftKeyboard.apk" in http://stackoverflow.com/questions/5742513/how-to-access-data-app-proc-on-android-for-normal-app/9458939#9458939 – user1234613 Feb 27 '12 at 04:31
 - 
                    _i do not understand the sentence "Though I cannot access /data/app, but I can access /data/app/SoftKeyboard.apk"_. The underlying file system is as Linux. Your app _(or the transient user that runs your app, if you want to use strict terms)_ does not have read permissions for the `/data/app` directory, but the files in this directory can be read by anyone (as long as she knows the exact path). – Alex Cohn Feb 16 '14 at 13:16
 
1 Answers
0
            
            
        If your app package is ziwu.ziwu.ziwu, then the APK file will most likely be "/data/app/ziwu.ziwu.ziwu-1.apk" and any process on the device has read access to this file. Only the root and the owner of this file (user system) have write permissions.
        Alex Cohn
        
- 56,089
 - 9
 - 113
 - 307