I have updated Android SDK to rev. 22 yesterday and there is no apkbuilder in tools

7 篇文章 0 订阅

转:http://stackoverflow.com/questions/16620655/i-have-updated-android-sdk-to-rev-22-yesterday-and-there-is-no-apkbuilder-in-to



I have checked with my friend who has Android SDK tools version 21, the apkbuilder is there. I have updated the Android SDK tools to version 22 and I can't find apkbuilder anymore.

So it seems that the Andorid SDK tool has replace the apkbuilder with something else? How can I make ant build.xml without apkbuilder? Is there some other way to build the unsigned apk for Android?

share improve this question
 

6 Answers

You may want to look at this.

After updating to SDK Tools to rev. 22 for the first time, you may need to relaunch Android SDK Manager again and install a new item: Android SDK Build-toolsenter image description here

After installing this, clean your projects and rebuild.

share improve this answer
 
7 
Did you checked? Build-tools do not include apkbuilder. –  Krom Stern  May 18 '13 at 18:12
2 
I have done this。 And build.xml is exists and i want to find the instead tool of apkbuilder.How the sdk tool ver.22 build apk?without apkbuilder? –  tommy cheung  May 19 '13 at 10:53 
 
Also perform "android update project -p ." in your project directory. This will update your build.xml. –  Lionel Port  Jun 7 '13 at 3:09
 
The apkbuilder/apkbuilder.bat wrappers around "com.android.sdklib.build.ApkBuilderMain" no longer exit in rev 22. –  miracle2k  Aug 4 '13 at 15:01
 
I hope to fix my rebuild problem after updating it. Thanks! –  Goku  Sep 23 '13 at 1:41

You could copy an apkbuilder.bat to your path_to_sdk_home/tools/, then continue you build. I found a copy here, and it worked.

share improve this answer
 
 
This solved it for me, thanks! –  o0'.  Oct 4 '13 at 9:36

In old version of AndroidSDK, the apkbuilder is just like a shell, actually it calls: ${sdk.dir}/tools/lib/sdklib.jar

So, if you deep into the root of apkbuilder, you can finder there are two ways to invoke it:

  1. from ant There is an ant-extend lib under: ${sdk.dir}/tools/lib/ant-tasks.jar So, you can invoke it like this:

    <path id="android.antlibs">
        <pathelement path="${sdk.dir}/tools/lib/ant-tasks.jar" />
    </path>
    
    <!-- Custom tasks -->
    <taskdef resource="anttasks.properties" classpathref="android.antlibs" />
    
    <apkbuilder
            outfolder="${out.absolute.dir}"
            resourcefile="${resource.package.file.name}"
            apkfilepath="${out.packaged.file}"
            debugpackaging="${build.is.packaging.debug}"
            debugsigning="${build.is.signing.debug}"
            verbose="${verbose}"
            hascode="${manifest.hasCode}"
            previousBuildType="${build.last.is.packaging.debug}/${build.last.is.signing.debug}"
            buildType="${build.is.packaging.debug}/${build.is.signing.debug}">
        <dex path="${intermediate.dex.file}"/>
        <sourcefolder path="${source.absolute.dir}"/>
        <jarfile refid="project.all.jars.path" />
        <nativefolder path="${native.libs.absolute.dir}" />
        <nativefolder refid="project.library.native.folder.path" />
        <extra-jars/>
    </apkbuilder>
    
  2. for script or other development You can use ${sdk.dir}/tools/lib/sdklib.jar, the apkbuilder was included in. Take a look at apkbuild.bat in previous version, at the end of the file:

    set jarfile=sdklib.jar
    set frameworkdir=
    
    if exist %frameworkdir%%jarfile% goto JarFileOk
        set frameworkdir=lib\
    
    if exist %frameworkdir%%jarfile% goto JarFileOk
        set frameworkdir=..\framework\
    
    :JarFileOk
    
    set jarpath=%frameworkdir%%jarfile%
    
    call %java_exe% -classpath %jarpath% com.android.sdklib.build.ApkBuilderMain %*
    
share improve this answer
 
 
This is the only answer that explains how to invoke ApkBuilder now. –  Chuck Batson  Aug 27 '14 at 15:31

Android SDK notes for rev.22 state:

Changed the structure of the SDK by adding a new build tool SDK Component, which is based on the existing platform-tools component. This change decouples the build tools versions from the IDE versions, allowing updates to the tools without requiring an IDE update.

One of the temporary options is to roll back your SDK tools back to rev.21 where apkbuilder existed. You can do that by backing up tools folder (e.g. rename it to tools_22) and downloading previous tools from rev.21: dl-ssl.google.com/android/repository/tools_r20-windows.zip, unpack it to your SDK and it will work like before.

share improve this answer
 
 
THX.Iwant to find a way to edit my build.xml to fit the new version tool .Or should i change builder to gradle or sth else? –  tommy cheung  May 19 '13 at 10:55 
 
In the case that will not roll back my sdk tool verison 21?In fact i want to know how build the apk in tools version 22?The sugest way? –  tommy cheung  May 19 '13 at 10:58
 
I know only of this solution. Maybe someone else knows a better way around rev.22 –  Krom Stern  May 19 '13 at 13:50

Doing a bit of research around this, it seems APKBuilder.bat, although deprecated, can still be used but will no longer be supported/enhanced. [1]

The new com.android.sdklib.build.APKBuilder Java class should now be used [2] as this is what will be developed, going forward.

share improve this answer
 
 
See liuyong's answer for a link to the bat. –  Steven Mark Ford  Jul 24 '13 at 10:08
 
It indeed appears as if the script has been removed. For now, using an old version works because the command line interface still exists as part of the Java class, though I wouldn't be surprised if that goes as well. –  miracle2k  Aug 4 '13 at 14:59

I find a way but i don't very sure of it. I saw a ant directory in tools directory and found a build.xml contains the new way to build apk. I also saw ant_task.jar in the tools/lib directory.When i unzip the jar i fount some classes like Apk ApkBuilderTask.class CheckEnvTask.class and so on... So i think the way is be changed to build apk with the ant Task,i 'll try to use the template to build the apk ,and if it works i will post the solution here. thanks!

share improve this answer
 
 
You can recreate your project build.xml to use the new method but running "android update project -p ." in your project directory. –  Lionel Port  Jun 7 '13 at 3:12

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值