Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apk存在多个架构so库时存在时,需要分开拷贝 #45

Closed
tjianli opened this issue Sep 25, 2015 · 3 comments
Closed

apk存在多个架构so库时存在时,需要分开拷贝 #45

tjianli opened this issue Sep 25, 2015 · 3 comments
Labels

Comments

@tjianli
Copy link

tjianli commented Sep 25, 2015

如果apk里面存在多个架构so库,IPluginManagerImpl里copyNativeLibs方法没有拷贝到对应文件夹下,会出现segment fault问题

for (String soName : soList.keySet()) {
Log.e(TAG, "==========so name=" + soName);
Set soPaths = soList.get(soName);
String soPath = findSoPath(soPaths);
//----分平台架构文件夹拷贝
String tmpSoPath = soPath;
tmpSoPath = tmpSoPath.replace("lib/","");
tmpSoPath = tmpSoPath.substring(0,tmpSoPath.indexOf('/'));
String tmpLibRootFolder = nativeLibraryDir + File.separator +tmpSoPath;

            if (soPath != null) {
                {
                    File file = new File(tmpLibRootFolder);
                    if(file.exists()){

                    }else{
                        file.mkdirs();
                    }
                }
                File file = new File(tmpLibRootFolder, soName);
                //----
                if (file.exists()) {
                    file.delete();
                }

......
.....
.....

@cmzy
Copy link
Member

cmzy commented Sep 30, 2015

其实我没明白,这个具体错误在哪里?目前只是拷贝对应平台的so库到目标目录下。

@tjianli
Copy link
Author

tjianli commented Sep 30, 2015

请先忽略上面那个issue

这几天发现几个问题:
1,缺少权限
android.permission.MODIFY_PHONE_STATE
android.permission.WRITE_SECURE_SETTINGS

2,注册静态服务crash
在com/morgoo/droidplugin/core/PluginProcessManager.java
registerStaticReceiver里面注册静态name=com.android.google.receiver.SendLogReceiver的服务会crash,不好意思,这几天研究用的临时apk有点乱,那个apk和log找不到了。。。

3,之前提出的so库问题
有个apk里面有libfight.so,这个支持armeabi和armeabi-v7a,但是在mi4,4.4.4-ktu84p上用现有方式总是提示这个so segmentfault错误。如果在copy so之前我这样处理就没问题,但是不知道方式可能通用
Log.e(TAG, "==========so name=" + soName);
Set soPaths = soList.get(soName);
String soPath = findSoPath(soPaths);

            ///
            String libDir = nativeLibraryDir;
            {
                if(soPath.contains("armeabi-v7a")){
                    libDir = nativeLibraryDir+"/armeabi-v7a";
                }
                File file = new File(libDir);
                if(!file.exists()){
                    file.mkdirs();
                }
            }
            ///

            if (soPath != null) {

                File file = new File(libDir, soName);
                if (file.exists()) {
                    file.delete();
                }

.....
.....

4,issue3延伸出来的问题,plugin会处理mips和x86的so库吗?

5,还有之前提到的一个issue,加载的apk有很大几率startactivity失败,一直停留在“加载中”这个启动界面上,被加载的apk中oncreate方法没被调用

@cmzy cmzy added the bug label Nov 12, 2015
@cmzy
Copy link
Member

cmzy commented Nov 12, 2015

fixed

@cmzy cmzy closed this as completed Nov 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants