{"action":"created","issue":{"url":"https://api.github.com/repos/alibaba/AndFix/issues/81","labels_url":"https://api.github.com/repos/alibaba/AndFix/issues/81/labels{/name}","comments_url":"https://api.github.com/repos/alibaba/AndFix/issues/81/comments","events_url":"https://api.github.com/repos/alibaba/AndFix/issues/81/events","html_url":"https://github.com/alibaba/AndFix/issues/81","id":117088793,"number":81,"title":"NoClassDefFoundError，再Patch之后，会在原本的类后添加了_CF后缀，然后就找不到了。","user":{"login":"ding102992","id":10256875,"avatar_url":"https://avatars.githubusercontent.com/u/10256875?v=3","gravatar_id":"","url":"https://api.github.com/users/ding102992","html_url":"https://github.com/ding102992","followers_url":"https://api.github.com/users/ding102992/followers","following_url":"https://api.github.com/users/ding102992/following{/other_user}","gists_url":"https://api.github.com/users/ding102992/gists{/gist_id}","starred_url":"https://api.github.com/users/ding102992/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ding102992/subscriptions","organizations_url":"https://api.github.com/users/ding102992/orgs","repos_url":"https://api.github.com/users/ding102992/repos","events_url":"https://api.github.com/users/ding102992/events{/privacy}","received_events_url":"https://api.github.com/users/ding102992/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-11-16T10:02:42Z","updated_at":"2015-12-21T01:47:32Z","closed_at":null,"body":"异常的打印信息如下：\r\n---\r\n```java\r\njava.lang.NoClassDefFoundError: Failed resolution of: Lcom/jingcai/apps/demo/andfix/Calculate_CF;\r\n                                                       at com.jingcai.apps.demo.andfix.MainActivity_CF.process(MainActivity.java:23)\r\n                                                       at com.jingcai.apps.demo.andfix.MainActivity.onClick(MainActivity.java:42)\r\n                                                       at android.view.View.performClick(View.java:4787)\r\n                                                       at android.view.View$PerformClick.run(View.java:19880)\r\n                                                       at android.os.Handler.handleCallback(Handler.java:739)\r\n                                                       at android.os.Handler.dispatchMessage(Handler.java:95)\r\n                                                       at android.os.Looper.loop(Looper.java:139)\r\n                                                       at android.app.ActivityThread.main(ActivityThread.java:5259)\r\n                                                       at java.lang.reflect.Method.invoke(Native Method)\r\n                                                       at java.lang.reflect.Method.invoke(Method.java:372)\r\n                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)\r\n                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)\r\nCaused by: java.lang.ClassNotFoundException: Didn't find class \"com.jingcai.apps.demo.andfix.Calculate_CF\" on path: DexPathList[[zip file \"/data/app/com.jingcai.apps.demo.andfix-1/base.apk\"],nativeLibraryDirectories=[/data/app/com.jingcai.apps.demo.andfix-1/lib/arm, /vendor/lib, /system/lib]]\r\n                                                       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)\r\n                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:511)\r\n                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:469)\r\n                                                       at com.jingcai.apps.demo.andfix.MainActivity_CF.process(MainActivity.java:23) \r\n                                                       at com.jingcai.apps.demo.andfix.MainActivity.onClick(MainActivity.java:42) \r\n                                                       at android.view.View.performClick(View.java:4787) \r\n                                                       at android.view.View$PerformClick.run(View.java:19880) \r\n                                                       at android.os.Handler.handleCallback(Handler.java:739) \r\n                                                       at android.os.Handler.dispatchMessage(Handler.java:95) \r\n                                                       at android.os.Looper.loop(Looper.java:139) \r\n                                                       at android.app.ActivityThread.main(ActivityThread.java:5259) \r\n                                                       at java.lang.reflect.Method.invoke(Native Method) \r\n                                                       at java.lang.reflect.Method.invoke(Method.java:372) \r\n                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950) \r\n                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745) \r\n                                                   \tSuppressed: java.lang.ClassNotFoundException: com.jingcai.apps.demo.andfix.Calculate_CF\r\n                                                       at java.lang.Class.classForName(Native Method)\r\n                                                       at java.lang.BootClassLoader.findClass(ClassLoader.java:781)\r\n                                                       at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)\r\n                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:504)\r\n                                                       \t\t... 13 more\r\n                                                    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available\r\n```\r\n\r\nCalculate类\r\n---\r\n```java\r\npublic class Calculate {\r\n    public static int add(int x,int y){\r\n        return x+y;\r\n    }\r\n\r\n    public static int multi(int x, int y){\r\n        return x * y;\r\n    }\r\n}\r\n```\r\n\r\nMainActivity\r\n---\r\n```java\r\npublic class MainActivity extends AppCompatActivity implements View.OnClickListener {\r\n\r\n    @Override\r\n    protected void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n        setContentView(R.layout.activity_main);\r\n        findViewById(R.id.btn_process).setOnClickListener(this);\r\n        findViewById(R.id.btn_detect).setOnClickListener(this);\r\n        findViewById(R.id.btn_update).setOnClickListener(this);\r\n    }\r\n\r\n    public void process() {\r\n        Toast.makeText(MainActivity.this, \"result:\" + Calculate.multi(3, 3), Toast.LENGTH_SHORT).show();\r\n    }\r\n\r\n    public void updatePatch() {\r\n        UpdateManager.getInstance().addPatch(Environment.getExternalStorageDirectory() + \"/out.apatch\");\r\n    }\r\n\r\n    public void detectFile() {\r\n        File file = new File(Environment.getExternalStorageDirectory() + \"/out.apatch\");\r\n        Toast.makeText(MainActivity.this, \"file exists:\" + file.exists(), Toast.LENGTH_SHORT).show();\r\n    }\r\n\r\n    @Override\r\n    public void onClick(View v) {\r\n        switch (v.getId()) {\r\n            case R.id.btn_detect:\r\n                detectFile();\r\n                break;\r\n            case R.id.btn_process:\r\n                process();\r\n                break;\r\n            case R.id.btn_update:\r\n                updatePatch();\r\n                break;\r\n\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nUpdateManager\r\n---\r\n```java\r\npublic class UpdateManager {\r\n\r\n\r\n    private static final String TAG = UpdateManager.class.getSimpleName();\r\n    private static UpdateManager mInstance;\r\n    private PatchManager mPatchManager;\r\n\r\n    private UpdateManager(){}\r\n\r\n    public static UpdateManager getInstance(){\r\n        if(mInstance == null){\r\n            synchronized (UpdateManager.class){\r\n                if(mInstance == null){\r\n                    mInstance = new UpdateManager();\r\n                }\r\n            }\r\n        }\r\n        return mInstance;\r\n    }\r\n\r\n    public void init(Context context,String appVersion){\r\n        mPatchManager = new PatchManager(context);\r\n        mPatchManager.init(appVersion);\r\n        Log.d(TAG, \"patch manager init,version:\" + appVersion);\r\n        mPatchManager.loadPatch();\r\n        Log.d(TAG, \"patch loaded\");\r\n    }\r\n\r\n    public void addPatch(String path){\r\n        // add patch at runtime\r\n        try {\r\n            mPatchManager.addPatch(path);\r\n            Log.d(TAG, \"apatch:\" + path + \" added.\");\r\n        } catch (IOException e) {\r\n            Log.e(TAG, \"\", e);\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n最后一句：\r\n> Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available\r\n\r\n\r\n会是造成异常的原因吗，求解。"},"comment":{"url":"https://api.github.com/repos/alibaba/AndFix/issues/comments/166172573","html_url":"https://github.com/alibaba/AndFix/issues/81#issuecomment-166172573","issue_url":"https://api.github.com/repos/alibaba/AndFix/issues/81","id":166172573,"user":{"login":"iwgang","id":3657121,"avatar_url":"https://avatars.githubusercontent.com/u/3657121?v=3","gravatar_id":"","url":"https://api.github.com/users/iwgang","html_url":"https://github.com/iwgang","followers_url":"https://api.github.com/users/iwgang/followers","following_url":"https://api.github.com/users/iwgang/following{/other_user}","gists_url":"https://api.github.com/users/iwgang/gists{/gist_id}","starred_url":"https://api.github.com/users/iwgang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iwgang/subscriptions","organizations_url":"https://api.github.com/users/iwgang/orgs","repos_url":"https://api.github.com/users/iwgang/repos","events_url":"https://api.github.com/users/iwgang/events{/privacy}","received_events_url":"https://api.github.com/users/iwgang/received_events","type":"User","site_admin":false},"created_at":"2015-12-21T01:47:32Z","updated_at":"2015-12-21T01:47:32Z","body":"同问题，LG G2， AOSP 5.1.1"}}