3

I'm trying to develop an app for my (very) old Android phone with Gingerbread, api 10.

But with android studio as IDE the problems seem to go on forever:

  • in project wizard, only api>=14 is supported
  • so I choose 14 and want to change later on
  • I change minSdkVersion in build.gradle(:app) to 10 -> minSdkVersion 10 cannot be smaller than version 14 declared in library
  • so I change implementation 'com.android.support:appcompat-v7:26.1.0' to implementation 'com.android.support:appcompat-v7:25.1.0'
  • I get errors¹ that some generated gradle chache files "values-v14.xml" are missing ressources

…and that's the point I don't know how to go on

As I thought, it can't be true, a project throws that manny errors, and I did not create a single class and did not write a single line of code, I tried building from commandline.

It works, but I got used to IDE-features and don't like missing them. So my question is:

How to develop a legacy android app for api levels down to 10 with android studio?
Is there a guide to go on fitting the project to api 10?

Was I on the "right" path at all?

Is there maybe a skeleton-project for a api level 10 app, which I could import (as if I could choose api 10 in project wizard)?

I am aware of the reasons, Google doesn't support api<14 anymore.

Still I don't see why I shouldn't be able to use my perfectly healthy hardware.
And still would I like to be able to write a simple app for my old phone.

¹ error log:

Information:Gradle tasks [:app:assembleDebug]
/home/aik/.gradle/caches/transforms-1/files-1.1/appcompat-v7-25.1.0.aar/2ab2d76d88a035b2d8a733b1b9a020a8/res/values-v14/values-v14.xml
Error:(8, 5) error: style attribute 'android:attr/textAllCaps' not found.
Error:resource android:style/TextAppearance.Material not found.
Error:resource android:style/TextAppearance.Material.Body1 not found.
Error:resource android:style/TextAppearance.Material.Body2 not found.
/home/aik/test_api10/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values-v14/values-v14.xml
Error:(5) style attribute 'android:attr/textAllCaps' not found.
Error:resource android:style/TextAppearance.Material.Button not found.
Error:resource android:style/TextAppearance.Material.Caption not found.
Error:resource android:style/TextAppearance.Material.Display1 not found.
Error:resource android:style/TextAppearance.Material.Display2 not found.
Error:resource android:style/TextAppearance.Material.Display3 not found.
Error:resource android:style/TextAppearance.Material.Display4 not found.
Error:resource android:style/TextAppearance.Material.Headline not found.
Error:resource android:style/TextAppearance.Material.Inverse not found.
Error:resource android:style/TextAppearance.Material.Large not found.
/home/aik/test_api10/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values-v11/values-v11.xml
Error:(6) error: resource android:attr/textColorHighlightInverse not found.
Error:(7) error: resource android:attr/textColorLinkInverse not found.
Error:(12) error: resource android:attr/textColorHighlightInverse not found.
Error:(13) error: resource android:attr/textColorLinkInverse not found.
Error:resource android:style/TextAppearance.Material.Large.Inverse not found.
Error:resource android:style/TextAppearance.Material.Widget.PopupMenu.Large not found.
Error:resource android:style/TextAppearance.Material.Widget.PopupMenu.Small not found.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
Information:BUILD FAILED in 10s
Information:25 errors
Information:0 warnings
Information:See complete output in console

EDIT I modified my gradle:app to match with the one from ישו אוהב אותך's skeleton-project. I did have to change compileSdkVersion, targetSdkVersion and androidTestImplementation in addition to my tries mentioned above. File looks like this now:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    defaultConfig {
        applicationId "dj.kai.test_api10"
        minSdkVersion 10
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:25.4.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'

    // this is the last support test for api >= 9
    androidTestImplementation 'com.android.support.test:runner:1.0.0'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.0'
}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
kai-dj
  • 315
  • 1
  • 18

1 Answers1

11

You can create Android project for API >= 9, there is no technical limitation on making the project. The only problem is Google didn't support old phone below API < 14. Google support library starting from 26 didn't support api < 14. So, you need to use support library 25. You also need to use support test that allow API version 10.

I've created a skeleton project for you. You can get it at https://github.com/isnotmenow/AndroidProjectForAPI9

Read about support test library which support API 9: https://developer.android.com/topic/libraries/testing-support-library/release-notes.html#espresso_300_runner_100_rules_100_androidtestorchestrator_100_2017-07-25_announcement

ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
  • 1
    Thank you very much for the effort! The skeleton-project builds, as well as my test-project when gradle:app adjusted like in your skeleton-project. – kai-dj Feb 16 '18 at 12:32