如何重用一个 Android 项目以获得两个不同的 APK。

huangapple go评论75阅读模式
英文:

How to reuse an Android project to have two different APK

问题

我以前在使用Android Studio的一个项目上工作过。现在我想要开始一个新项目,但具有类似的特性,所以我没有重新开始项目,而是复制了文件夹,改变了名称,并进行了一些功能修改。

然而,当我构建APK并尝试重新安装时,我的设备会提示以下信息:

> 您要安装此现有应用程序的更新吗?您现有的数据不会丢失。

在点击接受之前,我想知道这是否会删除我设备中使用第一个项目的应用程序。如果是这样,我想知道如何处理,或者至少如何避免这个问题。

我猜这可以通过更改项目的ID或其他简单的方法来实现,但最好再次确认一下。

英文:

I have previously worked on a project using Android Studio. Now I want to start a new project, but with similar characteristics, so instead of re-starting the project, I have copy the folder, changing the name and made few functionalities.

Nevertheless, when I have built the APK, and tried to reinstall it, my device prompt the following message:

> Do you want to install an update to this existing application? Your existing data will not be lost

Before pressing accept, I would like to know if this is going to remove the application that I had in my device with the first project that I was working with or not. If so, I would like to know how to do it, or at least how to avoid this issue.

I assume that it could be done by changing the id of the project, or any other simple solution, but it would be nice to double check

答案1

得分: 1

你需要更改应用程序 ID(包名)。 Android使用此值来唯一标识每个现有的应用程序。

每个Android应用程序都有一个唯一的应用程序ID,看起来像一个Java包名,比如com.example.myapp。此ID在设备上和Google Play商店中唯一标识您的应用程序。如果您想上传应用程序的新版本,应用程序ID(以及您用其签名的证书)必须与原始APK相同 - 如果您更改应用程序ID,Google Play商店将将APK视为完全不同的应用程序。因此,一旦发布应用程序,您就不应更改应用程序ID。

英文:

You need to change the application id (package name). Android uses such value to uniquely identify each existing app.

> Every Android app has a unique application ID that looks like a Java package name, such as com.example.myapp. This ID uniquely identifies your app on the device and in Google Play Store. If you want to upload a new version of your app, the application ID (and the certificate you sign it with) must be the same as the original APK—if you change the application ID, Google Play Store treats the APK as a completely different app. So once you publish your app, you should never change the application ID.

huangapple
  • 本文由 发表于 2020年10月15日 20:37:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/64371739.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定