Xposed模塊開發Cannot load module問題

想開發一個修改機器型號的模塊,都在VirtualXposed上成功運行機型修改,信心滿滿的裝到已經裝了xposed的真機上,結果不生效,查看log是模塊加載不成功

查看log如下

06-27 14:25:56.205 I/Xposed  (  318): Found Xposed class 'de/robv/android/xposed/XposedBridge', now initializing
06-27 14:25:56.751 I/Xposed  (  318): Loading modules from /data/app/com.xposed-1/base.apk
06-27 14:25:56.934 E/Xposed  (  318):   Cannot load module:
06-27 14:25:56.934 E/Xposed  (  318):   The Xposed API classes are compiled into the module's APK.
06-27 14:25:56.934 E/Xposed  (  318):   This may cause strange issues and must be fixed by the module developer.
06-27 14:25:56.934 E/Xposed  (  318):   For details, see: http://api.xposed.info/using.html

檢查了build.grade的引用應該是沒有問題的

dependencies {
    compileOnly 'de.robv.android.xposed:api:82'
    compileOnly 'de.robv.android.xposed:api:82:sources'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    }

但是還是抱着試一試的想法,嘗試註釋掉

    //implementation fileTree(dir: 'libs', include: ['*.jar'])

裝到機器中發現問題解決

分析:我這邊是把jar包放到libs下面的文件夾,官方文檔特別寫到不能使用compile,要用privode,而privode在Android Studio的3.1.4版本中換成了compileOnly,可能是後面的implementation覆蓋了前面的compileOnly 發此文爲記錄這一個神奇的問題,暫未找到其他方式,所以目前的解決方案是如果要用到其他jar包需要手動一個個添加,不能使用filetree的方式

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章