Closed JackButland closed 4 years ago
i can't say anything without exact procedures, logfiles, full project, etc.
Sure. here is a link to rebuilt apk https://dropmefiles.com/CmdCV. and that is an original one https://dropmefiles.com/DDyZ9. rebuilt is a result of command sequence 'apktool d original.apk; apktool b original/'. when I add original apk to dexpatcher-gradle project and try to use some classes from package com.google.android.gms patch successfully applies. but when I add rebuilt apk to the same project and try to apply the same patch I get errors like 'package com.google.android.gms not found'. Thanks.
please post the COMPLETE BUILD LOG.
Task :app:decodeApk I: Using Apktool 2.4.0 on apktool_rebuilt.apk I: Loading resource table... I: Decoding AndroidManifest.xml with resources... I: Loading resource table from file: /Users/mac1/AndroidStudioProjects/CoronavirusbyRebuild/app/build/intermediates/dexpatcher/apktool-framework/1.apk I: Regular manifest package... I: Decoding file-resources... I: Decoding values / XMLs... I: Copying raw classes.dex file... I: Copying raw classes2.dex file... I: Copying assets and libs... I: Copying unknown files... I: Copying original files...
Task :app:unpackApktoolAapt2 Task :app:provideDecodedApp
Task :app:sourceAppInfo minSdkVersion: '16' targetSdkVersion: '29' versionCode: '23' versionName: 1.7.1
Task :app:dedexAppClasses dex2jar /Users/mac1/AndroidStudioProjects/CoronavirusbyRebuild/app/apk/apktool_rebuilt.apk -> /Users/mac1/AndroidStudioProjects/CoronavirusbyRebuild/app/build/intermediates/dexpatcher/dedexed-classes/app-classes.jar com.googlecode.d2j.DexException: fail convert code for Lcom/github/mikephil/charting/data/DataSet;.getEntryIndex(FFLcom/github/mikephil/charting/data/DataSet$Rounding;)I at com.googlecode.d2j.dex.ExDex2Asm.convertCode(ExDex2Asm.java:44) at com.googlecode.d2j.dex.Dex2jar$2.convertCode(Dex2jar.java:132) at com.googlecode.d2j.dex.Dex2Asm.convertMethod(Dex2Asm.java:582) at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:441) at com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:457) at com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:126) at com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:275) at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:107) at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:290) at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:33) Caused by: java.lang.RuntimeException: fail exe a35 = a30 at com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.exec(BaseAnalyze.java:92) at com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.exec(BaseAnalyze.java:31) at com.googlecode.dex2jar.ir.ts.Cfg.dfs(Cfg.java:255) at com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.analyze0(BaseAnalyze.java:75) at com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.analyze(BaseAnalyze.java:69) at com.googlecode.dex2jar.ir.ts.Ir2JRegAssignTransformer.transform(Ir2JRegAssignTransformer.java:182) at com.googlecode.d2j.dex.Dex2jar$2.optimize(Dex2jar.java:167) at com.googlecode.d2j.dex.Dex2Asm.convertCode(Dex2Asm.java:449) at com.googlecode.d2j.dex.ExDex2Asm.convertCode(ExDex2Asm.java:41) ... 9 more Caused by: java.lang.NullPointerException at com.googlecode.dex2jar.ir.ts.an.SimpleLiveAnalyze.onUseLocal(SimpleLiveAnalyze.java:89) at com.googlecode.dex2jar.ir.ts.an.SimpleLiveAnalyze.onUseLocal(SimpleLiveAnalyze.java:27) at com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.onUse(BaseAnalyze.java:166) at com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.onUse(BaseAnalyze.java:31) at com.googlecode.dex2jar.ir.ts.Cfg.travel(Cfg.java:331) at com.googlecode.dex2jar.ir.ts.Cfg.travel(Cfg.java:387) at com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.exec(BaseAnalyze.java:90) ... 17 more
Task :app:packExtraAppResources Task :app:packAppComponents Task :app:preBuild UP-TO-DATE Task :app:preDebugBuild Task :app:compileDebugAidl NO-SOURCE Task :app:compileDebugRenderscript NO-SOURCE Task :app:checkDebugManifest Task :app:generateDebugBuildConfig Task :app:prepareLintJar UP-TO-DATE Task :app:generateDebugSources Task :app:javaPreCompileDebug Task :app:mainApkListPersistenceDebug Task :app:generateDebugResValues Task :app:generateDebugResources /Users/mac1/AndroidStudioProjects/CoronavirusbyRebuild/app/build/intermediates/dexpatcher/decoded-app/res/values/public.xml:1456: error: resource 'drawable/$avd_hide_password0' has invalid entry name '$avd_hide_password0'. Invalid character '$avd_hide_password0'. /Users/mac1/AndroidStudioProjects/CoronavirusbyRebuild/app/build/intermediates/dexpatcher/decoded-app/res/values/public.xml:1457: error: resource 'drawable/$avd_hide_password1' has invalid entry name '$avd_hide_password1'. Invalid character '$avd_hide_password1'. /Users/mac1/AndroidStudioProjects/CoronavirusbyRebuild/app/build/intermediates/dexpatcher/decoded-app/res/values/public.xml:1458: error: resource 'drawable/$avd_hide_password2' has invalid entry name '$avd_hide_password2'. Invalid character '$avd_hide_password2'. /Users/mac1/AndroidStudioProjects/CoronavirusbyRebuild/app/build/intermediates/dexpatcher/decoded-app/res/values/public.xml:1459: error: resource 'drawable/$avd_show_password0' has invalid entry name '$avd_show_password0'. Invalid character '$avd_show_password0'. /Users/mac1/AndroidStudioProjects/CoronavirusbyRebuild/app/build/intermediates/dexpatcher/decoded-app/res/values/public.xml:1460: error: resource 'drawable/$avd_show_password1' has invalid entry name '$avd_show_password1'. Invalid character '$avd_show_password1'. /Users/mac1/AndroidStudioProjects/CoronavirusbyRebuild/app/build/intermediates/dexpatcher/decoded-app/res/values/public.xml:1461: error: resource 'drawable/$avd_show_password2' has invalid entry name '$avd_show_password2'. Invalid character '$avd_show_password2'. /Users/mac1/AndroidStudioProjects/CoronavirusbyRebuild/app/build/intermediates/dexpatcher/decoded-app/res/values/public.xml:1467: error: resource 'drawable/$ic_launcher_foreground0' has invalid entry name '$ic_launcher_foreground0'. Invalid character '$ic_launcher_foreground__0'.
Task :app:processIdMappingsDebug Task :app:mergeDebugResources Task :app:createDebugCompatibleScreenManifests Task :app:processDebugManifest Task :app:processDebugResources
Task :app:compileDebugJavaWithJavac FAILED /Users/mac1/AndroidStudioProjects/CoronavirusbyRebuild/app/src/main/java/com/coronavirusby/App.java:5: error: package com.google.android.gms.ads does not exist import com.google.android.gms.ads.MobileAds; ^ /Users/mac1/AndroidStudioProjects/CoronavirusbyRebuild/app/src/main/java/com/coronavirusby/App.java:6: error: package com.google.android.gms.ads does not exist import com.google.android.gms.ads.RequestConfiguration; ^ /Users/mac1/AndroidStudioProjects/CoronavirusbyRebuild/app/src/main/java/com/coronavirusby/App.java:20: error: cannot find symbol RequestConfiguration rc = new RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("6B1ED7527E1BC020E007A56D53CA0B9E")).build(); ^ symbol: class RequestConfiguration location: class App /Users/mac1/AndroidStudioProjects/CoronavirusbyRebuild/app/src/main/java/com/coronavirusby/App.java:20: error: package RequestConfiguration does not exist RequestConfiguration rc = new RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("6B1ED7527E1BC020E007A56D53CA0B9E")).build(); ^ /Users/mac1/AndroidStudioProjects/CoronavirusbyRebuild/app/src/main/java/com/coronavirusby/App.java:21: error: cannot find symbol MobileAds.setRequestConfiguration(rc); ^ symbol: variable MobileAds location: class App 5 errors
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 12s 20 actionable tasks: 19 executed, 1 up-to-date
there are many issues with your build.
note that you can't just throw your apk in the sample and expect it to work. EVERY android configuration in the build scripts has to be tailored for your project. information on how to do this is explained in the sample comments or comes from regular android development and the user is required to be familiar with it before using dxp.
1) minSdkVersion issue: ok you fixed it already.
2) app:dedexAppClasses issues: dex2jar is unable to process your dex. you are probably not using the latest version of dex2jar that i published. see the dxp repo. if you are, as a workaround, you can ask dex2jar not to translate code. this should at least make the symbols available
3) :app:generateDebugResources issues: this is covered in the dxp issue trackers and the dxp-gradle release notes.
4) :app:compileDebugJavaWithJavac issues: com.google.android.gms.ads.MobileAds is not available to javac. does it come from the original apk? then dex2jar is failing. are you adding it yourself? then you are not doing it right.
more issues would probably appear if these issues are sorted out.
if dex2jar is the culprit and you are using the latest version, you can set importSymbols=false and declare all needed symbols in the patch.
i don't think replacing the apktool round-tripped apk with the original apk will fix any of these issues. (if it does, i want to see the successful dxp-gradle build log.) if dex2jar can process the original but not the round-tripped apk, that is probably an apktool/smali bug.
This issue was fixed by just using the latest versions of tools. It was silly of me not to check em. In any case it's a lil bit difficult for me to get into internals of those tools due to lack of examples. Thank u very much
thanks!
Hi I made an experiment pathing some apk. Sometimes it's more suitable to do it using small (f.e. when you need to add some calls/ change some values inside method. but not to append or prepend). So I added some resources and edited some calls using smali and then build apk with Apktool manually. This apk is valid and successfully runs on my device. But then I wanted to edit result apk some more by adding some classes and there I choose dexpatcher-gradle. However after adding some classes when making build I see bunch of errors 'package XXX does not exist'. Though this package definitely exists in original version. When I make the same changes with dexpatcher to original apk the build process succeeds. Is it possible that during using Apktool apk was some kind of corrupted? Or maybe dexpatcher provides options to edit apk using smali not java? Apk was loaded to dexpatcher-gradle-project unsigned. Thanks