2

I have my Android App source code ready, I can compile the release under Windows without any problem. I'm searching a solution in order to compile the release APK under CentOS Server 6.5

I want to communicate with the server via the in-server hosted PHP web app, when a user wish to generate his own APK, I modify the values in strings.xml inputted by the user, running PHP exec function, I need to generate the APK file in order to copy it to a directory where the website user is able to download it, then upload directly to Google Play.

The android app targets API 10

Any ideas about how to compile the source code in CentOS, sign the APK for release?

Hamza
  • 1,087
  • 4
  • 21
  • 47
  • Try [this](http://tboxmy.blogspot.in/2012/07/develop-android-apps-with-eclipse-on.html) tutorial if you want to achieve it through eclipse IDE for android. – Arnab Nandy Nov 16 '14 at 08:28
  • I want everything run in the console, no IDE or any GUI – Hamza Nov 16 '14 at 17:13
  • As it stands, you are asking too broad question (i.e., "Write me a _tutorial_ in setting up build environment in CentOS"). Please narrow down the scope. Try online tutorials on continuous integration, start with, for example, Jenkins. – ozbek Nov 17 '14 at 03:13
  • Are you using Android studio with gradle for your windows dev? – iagreen Nov 17 '14 at 03:59
  • @shoerat I'm not asking for how to build the whole android environment, but the tools available for CentOS in order to compile the project into APK, I can handle the key and apk signing things under Linux, but can't find yet a good way to compile the project into apk file – Hamza Nov 17 '14 at 12:37
  • @Hamza, I am also not talking about [building Android](http://source.android.com/source/building.html). Did you take a look on Jenkins? How about Ant? Gradle? – ozbek Nov 18 '14 at 01:31
  • 1
    If you use gradle on Windows, why not use it in CentOS? and what errors occur if you do gradle build? – Chk0nDanger Nov 18 '14 at 01:37

1 Answers1

3

1. Setup the build environment

  • Install Java (will need for jarsigner, SDK Manager, etc.)
  • Download the Android SDK
  • Install the appropriate version of Gradle for your build script
  • Install the Android build tools and SDK version you need from the SDK Manager via the command line

2. Create a keystore or copy it from another machine

keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

3. Add signing configuration to your gradle script

android {
    ...
    signingConfigs {
        release {
            storeFile file("release.keystore")
            storePassword "******"
            keyAlias "******"
            keyPassword "******"
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
}

4. Run gradle assembleRelease on your project's build script

Community
  • 1
  • 1
Jeffrey Mixon
  • 12,846
  • 4
  • 32
  • 55