我想自行卸载我的应用程序,但它在 SerialVersionUID 上抛出 NullPointerException 不知道这里有什么问题?
public void UnInstallApplication() throws NameNotFoundException
{
Intent intent = new Intent(Intent.ACTION_DELETE, Uri.fromParts("package",
getPackageManager().getPackageInfo("com.XXX.XXX", 0).packageName,null));
startActivity(intent);
}
或者我在下面使用了这一行(在函数中插入了包名)但结果相同!
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE);
uninstallIntent.setData(Uri.parse("package:" + packagename));
startActivity(uninstallIntent);