简体   繁体   English

在android eclipse中使用一个代码构建两个不同的apk

[英]Build two different apk using one single code in android eclipse

I am still working with Eclipse to develop android applications. 我仍在与Eclipse合作开发android应用程序。 Now there is a situation where I am supposed to build 2 different applications (You can consider as free and non-free version apk) using same app-code. 现在有一种情况,我应该使用相同的应用程序代码来构建2个不同的应用程序(您可以将其视为免费和非免费版本apk)。 I have got thousands of links regarding build.gradle and application package-name and others on google, but I don't how to build/use it in Eclipse. 我在Google上有成千上万个关于build.gradleapplication package-name的链接,但是我没有如何在Eclipse中构建/使用它。

Another question I have is how to point to 2 different images based on different application.? 我还有另一个问题是如何根据不同的应用程序指向2张不同的图像?

If you want to release two different build (paid and free). 如果要发布两个不同的版本(收费和免费)。 You need to change the package name. 您需要更改软件包名称。 Just goto the manifest file. 只需转到清单文件。 For example: for free version 例如:免费版

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.free">

and similarly for paid version 和类似的付费版本

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.paid">

Alternatively, I will recommend you to use In app purchase feature and release only build 另外,我建议您使用应用内购买功能并仅发布内部版本

Try this.. Is there any way to integrate Eclipse with Gradle in Android project? 试试这个。. 有什么方法可以将Eclipse与Gradle集成到Android项目中? .. There is no simple answer for this question.. Either you use eclipse with gradle and set two flavours with different in your build.gradle ..这个问题没有简单的答案..要么您将eclipse与gradle一起使用,然后在build.gradle中设置两个不同的口味

productFlavors {
    free {
        applicationId 'your.package.name.free'
    }
    paid {
        applicationId 'your.package.name.paid'
    }
}

or else just copy your project twice and change package name. 否则,只需复制您的项目两次并更改包名称。 If you want to upload both your apps in play store then you need two different package names. 如果您要在Play商店中上传两个应用程序,则需要两个不同的程序包名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM