what is wrong with my code? when I comment it,It works very well.
public void sendToOther(){
    PackageManager pm=getActivity().getPackageManager();
    try {
        PackageInfo info=pm.getPackageInfo(getActivity().getPackageName(), 0);
        ApplicationInfo ainfo = info.applicationInfo;
        File src = new File(ainfo.sourceDir);
        File dest = new File(getActivity().getExternalCacheDir(), "myfile.apk");
        if (src.exists()) {
            copyFile(src,dest);
            try{
                Intent intent = new Intent();
                intent.setAction(Intent.ACTION_SEND);
                intent.setType("image/jpeg");
                intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(dest));
                startActivity(intent);
            }catch (Exception e){
                Log.e("tag", e.toString());
            }
        }
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
when I want to run this code in my device, it says:
Waiting for device.
Target device: sony-st25i-192.168.1.102:5555
Uploading file
    local path: /mylocalpath/myapp.apk
    remote path: /data/local/tmp/com.myapp
Installing com.upkonid
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.myappp"
pkg: /data/local/tmp/com.myapp
Failure [INSTALL_FAILED_DEXOPT]
I searched a lot and I didn't find any solution, please help