« Androidアプリをlinuxコマンドラインでビルド(CentOS6.9 64bit) | メイン | linuxにうっかり貯めてしまったメールをgmailへ »

Android

Androidアプリをlinuxコマンドラインでビルド(CentOS7.3 32bit)

 今回のOSは
CentOS-7-i386-Minimal-1611.iso
で構築した32ビット版のミニマムインストール
CentOS release 7.3.1611 (AltArch)
javac 1.8.0_171
openjdk version "1.8.0_171"
ldd (GNU libc) 2.17
CentOS7 64bitの時と同様の手順でビルドすると
:app:mergeDebugResources
AAPT err(Facade for 25944244): /opt/android-sdk/build-tools/25.0.2/aapt: /opt/android-sdk/build-tools/25.0.2/aapt: バイナリファイルを実行できません
このエラーメッセージからは様々な情報見つかるが、そもそも32ビットOSには対応していないことが原因。エミュレータの為なのか???
 どうしても32ビットOSでビルドしたければ、32ビット版の build-toolsを指定する...▼
●Build Tools Version を23.0.1へ変更
$ vi app/build.gradle
apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "23.0.3" ←"25.0.2"★
    defaultConfig {
        applicationId "asia.remix.daydreammovie"
        minSdkVersion 17
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    testCompile 'junit:junit:4.12'
}
して再びビルドすると /opt/android-sdk/build-tools/23.0.3 がインストールされ、さらに
* What went wrong:
A problem occurred configuring project ':app'.
> The SDK Build Tools revision (23.0.3) is too low for project ':app'. Minimum required is 25.0.0
なるエラーメッセージ。32ビットOSで動作する23.0.3より上げられない為
●Android plugin for Gradle Vesion を2.2.3へ変更
$ vi build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3' ←2.3.3★

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven { url 'https://maven.google.com' }
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
これでビルドに成功。ちなみに CentOS6.9 32bit でも同じ。情報源は
●Error:The SDK Build Tools revision (23.0.3) is too low for project ':app'. Minimum required is 25.0.0
https://stackoverflow.com/questions/41890659/errorthe-sdk-build-tools-revision-23-0-3-is-too-low-for-project-app-minim
●Lubuntu 16.04 32bit で AndroidStudio2.3.2を使う手順
http://hinokiyo.hatenablog.com/entry/2017/05/21/Lubuntu_16.04_32bit_%E3%81%A7_AndroidStudio2.3.2%E3%82%92%E4%BD%BF%E3%81%86%E6%96%B9%E6%B3%95

トラックバック

このエントリーのトラックバックURL:
https://www.remix.asia/cgi/mt/mt-tb.cgi/7676

コメントを投稿

(いままで、ここでコメントしたことがないときは、コメントを表示する前にこのブログのオーナーの承認が必要になることがあります。承認されるまではコメントは表示されません。そのときはしばらく待ってください。)