反编译的 APK,Catlog "ClassNotFound" 错误
Posted
技术标签:
【中文标题】反编译的 APK,Catlog "ClassNotFound" 错误【英文标题】:Decompiled APK, Catlog "ClassNotFound" Errors 【发布时间】:2016-05-14 17:46:30 【问题描述】:您好,我正在尝试为我的小米易相机改造一个应用程序,以便在相机电池电量不足时推送通知。该应用程序具有执行此操作的所有功能,只是没有我需要的功能。所以我使用APKStudio反编译并导入到eclipse中,但是我得到了一堆ClassNotFound错误。
我认为这是因为 lib 实际上由 .smali 而非 .class 组成。但我不是 100% 确定。
这是目录:
02-04 13:16:47.426: I/art(2347): Not late-enabling -Xcheck:jni (already on)
02-04 13:16:47.435: W/System(2347): ClassLoader referenced unknown path: /data/app/com.xiaomi.xy.sportscamera-1/lib/x86
02-04 13:16:47.435: D/androidRuntime(2347): Shutting down VM
02-04 13:16:47.435: E/AndroidRuntime(2347): FATAL EXCEPTION: main
02-04 13:16:47.435: E/AndroidRuntime(2347): Process: com.xiaomi.xy.sportscamera, PID: 2347
02-04 13:16:47.435: E/AndroidRuntime(2347): java.lang.RuntimeException: Unable to instantiate application com.ants360.z13.activity.CameraApplication: java.lang.ClassNotFoundException: Didn't find class "com.ants360.z13.activity.CameraApplication" on path: DexPathList[[zip file "/data/app/com.xiaomi.xy.sportscamera-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xiaomi.xy.sportscamera-1/lib/x86, /vendor/lib, /system/lib]]
02-04 13:16:47.435: E/AndroidRuntime(2347): at android.app.LoadedApk.makeApplication(LoadedApk.java:578)
02-04 13:16:47.435: E/AndroidRuntime(2347): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4680)
02-04 13:16:47.435: E/AndroidRuntime(2347): at android.app.ActivityThread.-wrap1(ActivityThread.java)
02-04 13:16:47.435: E/AndroidRuntime(2347): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
02-04 13:16:47.435: E/AndroidRuntime(2347): at android.os.Handler.dispatchMessage(Handler.java:102)
02-04 13:16:47.435: E/AndroidRuntime(2347): at android.os.Looper.loop(Looper.java:148)
02-04 13:16:47.435: E/AndroidRuntime(2347): at android.app.ActivityThread.main(ActivityThread.java:5417)
02-04 13:16:47.435: E/AndroidRuntime(2347): at java.lang.reflect.Method.invoke(Native Method)
02-04 13:16:47.435: E/AndroidRuntime(2347): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
02-04 13:16:47.435: E/AndroidRuntime(2347): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
02-04 13:16:47.435: E/AndroidRuntime(2347): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.ants360.z13.activity.CameraApplication" on path: DexPathList[[zip file "/data/app/com.xiaomi.xy.sportscamera-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xiaomi.xy.sportscamera-1/lib/x86, /vendor/lib, /system/lib]]
02-04 13:16:47.435: E/AndroidRuntime(2347): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
02-04 13:16:47.435: E/AndroidRuntime(2347): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
02-04 13:16:47.435: E/AndroidRuntime(2347): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
02-04 13:16:47.435: E/AndroidRuntime(2347): at android.app.Instrumentation.newApplication(Instrumentation.java:981)
02-04 13:16:47.435: E/AndroidRuntime(2347): at android.app.LoadedApk.makeApplication(LoadedApk.java:573)
02-04 13:16:47.435: E/AndroidRuntime(2347): ... 9 more
02-04 13:16:47.435: E/AndroidRuntime(2347): Suppressed: java.lang.ClassNotFoundException: com.ants360.z13.activity.CameraApplication
02-04 13:16:47.435: E/AndroidRuntime(2347): at java.lang.Class.classForName(Native Method)
02-04 13:16:47.435: E/AndroidRuntime(2347): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
02-04 13:16:47.435: E/AndroidRuntime(2347): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
02-04 13:16:47.435: E/AndroidRuntime(2347): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
02-04 13:16:47.435: E/AndroidRuntime(2347): ... 12 more
02-04 13:16:47.435: E/AndroidRuntime(2347): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
看起来没有像 ProGuard 之类的反反编译。
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.xiaomi.xy.sportscamera" platformBuildVersionCode="22" platformBuildVersionName="5.1.1-1819727">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.GET_TASKS"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.READ_LOGS"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.MEDIA_CONTENT_CONTROL"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RESTART_PACKAGES"/>
<uses-permission android:name="android.permission.BATTERY_STATS"/>
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"/>
<uses-permission android:name="com.xiaomi.market.sdk.UPDATE"/>
<uses-permission android:name="com.xiaomi.permission.AUTH_SERVICE"/>
<uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="com.xiaomi.channel.GAME_SERVICE_PERMISSION"/>
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:largeHeap="true" android:name="com.ants360.z13.activity.CameraApplication" android:supportsRtl="true" android:theme="@style/AppTheme">
<meta-data android:name="veengine_version" android:value="5"/>
<activity android:name="com.ants360.z13.activity.LogoSplashActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.ants360.z13.activity.LocalPicEditActivity" android:screenOrientation="portrait" android:theme="@style/PicEditStyle"/>
<activity android:name="com.ants360.z13.activity.CameraVideoSplendidActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:launchMode="singleTask" android:name="com.ants360.z13.activity.SnsHomeActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:configChanges="keyboardHidden|orientation|screenSize" android:name="com.ants360.z13.activity.LandscapeCameraControlActivity" android:screenOrientation="landscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
<activity android:name="com.ants360.z13.activity.SnsPhotoActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.SnsViewPhotoActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:configChanges="keyboardHidden|orientation|screenSize" android:name="com.ants360.z13.activity.SnsVideoActivity"/>
<activity android:launchMode="singleTask" android:name="com.ants360.z13.activity.CameraConnectionFailedActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.CameraQuickRecordShareActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.QuickRecordEditActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.DownloadPhotoShowActivity" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.CameraMediaShowActivity" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.PhotoSetDetailShowActivity" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.LocalVideoPuzzleActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.CameraFileDownLoadActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.CameraSettingActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.CameraSDCardActivity" android:screenOrientation="portrait" android:theme="@style/SDCardSettingTheme"/>
<activity android:name="com.ants360.z13.activity.CameraWifiSettingActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.CameraUpgradeActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:launchMode="singleTask" android:name="com.ants360.z13.activity.CameraUpgradeWaittingActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.CameraUpgradeSuccessActivity" android:screenOrientation="portrait"/>
<activity android:name="com.ants360.z13.activity.CameraUpgradeFailActivity" android:screenOrientation="portrait"/>
<activity android:name="com.ants360.z13.activity.FirmwareDownloadActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.SettingActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.VideoCropActivity" android:screenOrientation="portrait"/>
<activity android:name="com.ants360.z13.activity.VideoEditActivity" android:screenOrientation="portrait"/>
<activity android:name="com.ants360.z13.activity.LocalMediaShowActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.SnsWebViewActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.SnsVideoMoreActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.FeedbackActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.moments.NotificationListActivity" android:screenOrientation="portrait" android:theme="@style/MomentsTheme" android:windowSoftInputMode="stateHidden"/>
<activity android:name="com.ants360.z13.moments.EditPersonalActivity" android:screenOrientation="portrait" android:theme="@style/MomentsTheme" android:windowSoftInputMode="stateHidden"/>
<activity android:name="com.ants360.z13.moments.ReportLowersActivity" android:screenOrientation="portrait" android:theme="@style/MomentsTheme"/>
<activity android:name="com.ants360.z13.activity.CameraUpgradeHelpActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.CameraHelpActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.FaqActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:configChanges="orientation" android:label="@string/xiaomi_login" android:name="com.xiaomi.account.openauth.AuthorizeActivity" android:windowSoftInputMode="stateHidden"/>
<activity android:configChanges="keyboardHidden|orientation|screenSize" android:name="cn.sharesdk.framework.ShareSDKUIShell" android:screenOrientation="portrait" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:windowSoftInputMode="adjustResize|stateHidden">
<intent-filter>
<data android:scheme="tencent100371282"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:configChanges="keyboardHidden|orientation|screenSize" android:name="com.mob.tools.MobUIShell" android:screenOrientation="portrait" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:windowSoftInputMode="adjustResize|stateHidden">
<intent-filter>
<data android:scheme="tencent100371282"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:configChanges="keyboardHidden|orientation|screenSize" android:exported="true" android:launchMode="singleInstance" android:name="com.xiaomi.xy.sportscamera.wxapi.WXEntryForXiaoyiActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize" android:label="@string/app_name" android:name="com.facebook.FacebookActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
<activity android:name="com.ants360.z13.activity.LocalVideoEditActivity"/>
<receiver android:name="com.ants360.z13.recevier.CheckFirmwareUpgradeRecevier">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
<action android:name="camera.intent.action.cancel.firmware.download"/>
</intent-filter>
</receiver>
<receiver android:name="com.ants360.z13.recevier.DownloadCompleteRecevier">
<intent-filter>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
</intent-filter>
</receiver>
<activity android:name="com.ants360.z13.activity.DetailGridViewActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.activity.CameraVideoEditActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.community.AccountActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.community.CommunityMessageActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.community.CommunityDetailActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme" android:windowSoftInputMode="stateAlwaysHidden|stateAlwaysVisible|adjustResize"/>
<activity android:name="com.ants360.z13.community.CommunityThemeActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.community.AccountSettingActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme"/>
<activity android:name="com.ants360.z13.community.ReportOrShareActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme" android:windowSoftInputMode="stateVisible"/>
<activity android:name="com.ants360.z13.community.TestActivity" android:screenOrientation="portrait" android:theme="@style/CameraTheme" android:windowSoftInputMode="stateVisible"/>
<activity android:name="com.ants360.z13.community.FullScreenImageActivity" android:screenOrientation="portrait" android:theme="@style/FullImage"/>
<receiver android:enabled="true" android:name="com.google.android.gms.analytics.AnalyticsReceiver">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH"/>
</intent-filter>
</receiver>
<service android:enabled="true" android:exported="false" android:name="com.google.android.gms.analytics.AnalyticsService"/>
<receiver android:exported="true" android:name="com.google.android.gms.analytics.CampaignTrackingReceiver">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER"/>
</intent-filter>
</receiver>
<service android:name="com.google.android.gms.analytics.CampaignTrackingService"/>
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
<meta-data android:name="com.google.android.gms.analytics.globalConfigResource" android:resource="@xml/global_tracker"/>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/application_id"/>
</application>
</manifest>
根文件结构:
src <-- empty
gen
Android 5.1.1
assets
bin
lib
original
res
smali
unknown <-- just contains unimportant "mistats_version" text file
AndroidManifest.xml
project.properties
【问题讨论】:
【参考方案1】:如果您想为应用添加新功能,您必须学习SMALI,无法将APK完全转换为JAVA。我从来没有用过APKStudio,但我可以推荐你dex2jar或APKtool,在THIS网站你可以找到如何重新解码和构建APP的推荐。
【讨论】:
嗯尝试这种方式,但只是解码和构建而不进行更改,它会在模拟器中吐出“失败 [INSTALL_FAILED_NO_MATCHING_ABIS]” 编辑:也适用于原始 apk。我想这是模拟器设置的问题 好吧,我认为在使用 ARM 设置新的虚拟设备后它可以工作,但我想我用原始 apk 测试了两次。我在手机上使用teamviewer,可能忘记了。无论如何,它会抛出 [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION] 即使我没有进行任何更改并在反编译后直接重建。使用“apktool d test.apk”进行反编译,使用“apktool b -c test”使用原始证书/签名重新编译。 上次更新:再次使用 APKStudio,这次正确设置了签名部分,一切正常。不知道为什么 -c 标志不适用于 apktool。以上是关于反编译的 APK,Catlog "ClassNotFound" 错误的主要内容,如果未能解决你的问题,请参考以下文章