Unable to make a Cordova WebView on Android

£可爱£侵袭症+ 提交于 2020-02-24 09:09:24

问题


I'm following the instructions here to setup an Android WebView but I cannot get past step #2 below:

  1. Navigate to the Android package's /framework directory and run ant jar. It creates the Cordova .jar file, formed as /framework/cordova-x.x.x.jar.

Running ant returns an error:

build.xml:42: You need to create the file 'local.properties' by running 'android update project -p .' here.

How can I get past this problem?


回答1:


  1. You will have to choose the version of android you want to use, if you have downloaded the Android SDK and added to the path variable of your system you can do this:

    android list targets
    

    It will give you an answer like this one:

    Available Android targets:
    ----------
    id: 1 or "android-8"
    Name: Android 2.2
    Type: Platform
    API level: 8
    Revision: 3
    Skins: WQVGA432, QVGA, WQVGA400, WVGA854, WVGA800 (default), HVGA
    ABIs : armeabi
    ----------
    id: 2 or "android-17"
    Name: Android 4.2.2
    Type: Platform
    API level: 17
    Revision: 2
    Skins: WXGA720, WXGA800-7in, WQVGA432, WSVGA, QVGA, WQVGA400, WXGA800, WVGA854, WVGA800 (default), HVGA
    ABIs : armeabi-v7a, x86
    ----------
    id: 3 or "Google Inc.:Google APIs:17"
    Name: Google APIs
    Type: Add-On
    Vendor: Google Inc.
    Revision: 3
    Description: Android + Google APIs
    Based on Android 4.2.2 (API level 17)
    Libraries:
    * com.google.android.media.effects (effects.jar)
      Collection of video effects
    * com.android.future.usb.accessory (usb.jar)
      API for USB Accessories
    * com.google.android.maps (maps.jar)
      API for Google Maps
    Skins: WVGA854, WQVGA400, WSVGA, WXGA800-7in, WXGA720, HVGA, WQVGA432, WVGA800 (default), QVGA, WXGA800
    ABIs : armeabi-v7a
    ----------
    id: 4 or "android-19"
    Name: Android 4.4
    Type: Platform
    API level: 19
    Revision: 1
    Skins: WXGA720, WXGA800-7in, WQVGA432, WSVGA, QVGA, WQVGA400, WXGA800, WVGA854, WVGA800 (default), HVGA
    ABIs : armeabi-v7a
    
  2. I choose the highest one i have so I did:

    android update project -p . -t android-19
    
  3. And finally

    ant jar
    

    The result is something like:

    jar:
    [jar] Building jar: C:\Users\Daniele\Desktop\cordova-android\framework\cor
    dova-3.5.1.jar
    
    BUILD SUCCESSFUL
    Total time: 11 seconds
    

Now you've got your jar. (A more detailed explanation can be found at Where is cordova-2.7.0.jar?)




回答2:


follow the instruction, run 'android update project -p .'



来源:https://stackoverflow.com/questions/24718664/unable-to-make-a-cordova-webview-on-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!