How do you build and deploy to an older version of android for ionic / cordova

前端 未结 5 1548
耶瑟儿~
耶瑟儿~ 2020-12-31 01:25

Using Ionic 1.0.0 beta-8

After creating a new app, I built and deployed it to a Nexus 5 emulator and it worked fine. But when I tried to debug it on my Android 2.2 p

相关标签:
5条回答
  • 2020-12-31 01:53

    According to Ionic Platform notes, Ionic targets iPhone and Android devices (currently). It also support iOS 6+, and Android 4.0+ (though 2.3 should work). However, since there are a lot of different Android devices, it's possible certain ones might not work. Ionic did not guaranty for Android 2.3 hence Android 2.2 will be out of scope.

    Hence, I think that is the reason why you are having challenges.

    0 讨论(0)
  • 2020-12-31 01:53

    It would appear that cdvCompileSdkVersion is used to determine build SDK and NOT targetSdkVersion as one would use in native android apps.

    0 讨论(0)
  • 2020-12-31 01:55

    this question is similar to yours. stackoverflow

    go to your AndroidManifest.xml, find these to control your sdk buildversion.

    <preference name="android-minSdkVersion" value="XX"> // value is the API LEVEL
    <preference name="android-targetSdkVersion" value="XX">
    

    *targetSdk = tell phonegap which android build version to use,
    *MinSdk is to limit user who want to download it.
    check the API LEVEL of android build here.

    In Your case: for android 2.2, use value= 8(API level 8)

        <preference name="android-minSdkVersion" value="8"> //android 2.2
        <preference name="android-targetSdkVersion" value="17"> //android 4.2
    

    NOTE: I doubt android 2.2(API level 8) can run API level 17(android 4.2).

    0 讨论(0)
  • 2020-12-31 02:14

    FYI, Google back-ported features from Honeycomb and again from later versions of Android into a "compatibility" library. You might be able to install that and get your app working on older versions of Android. You would need to update your Android SDK and install this library.

    See Android Support Library docs.

    If you're using Ionic, you could add a hook script that copies the library into your project when you add Android as a platform or start a build.

    0 讨论(0)
  • 2020-12-31 02:14

    Change value of "android-minSdkVersion" in config.xml of your ionic project. It should look like below:

    <preference name="android-minSdkVersion" value="14"/>
    
    0 讨论(0)
提交回复
热议问题