android4.4编译错误,Android4.4编译出现checkapi错误及解决办法

在编译Android系统时遇到checkapi错误,显示多处公共类被移除,尝试删除out目录、恢复修改文件及更新API未成功。最终通过对比current.txt和19.txt删除19.txt中相应定义,成功编译。问题可能与先前删除的frameworks中的test目录有关,但具体原因不明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

昨天上午不知道修改了哪里编译Android系统后出现checkapi错误,发现修改的文件跟API没关系,错误如下:

Checking API: checkapi-last

Checking API: checkapi-current

Compiling SDK Stubs: out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes.jar

frameworks/base/api/current.txt:23573: error 8: Removed public class android.test.ActivityInstrumentationTestCase

frameworks/base/api/current.txt:23580: error 8: Removed public class android.test.ActivityInstrumentationTestCase2

frameworks/base/api/current.txt:23588: error 8: Removed public class android.test.ActivityTestCase

frameworks/base/api/current.txt:23595: error 8: Removed public class android.test.ActivityUnitTestCase

frameworks/base/api/current.txt:23620: error 8: Removed public class android.test.AndroidTestRunner

frameworks/base/api/current.txt:23641: error 8: Removed public class android.test.ApplicationTestCase

frameworks/base/api/current.txt:23650: error 8: Removed public class android.test.AssertionFailedError

frameworks/base/api/current.txt:23655: error 8: Removed public class android.test.ComparisonFailure

frameworks/base/api/current.txt:23675: error 8: Removed public class android.test.InstrumentationTestRunner

frameworks/base/api/current.txt:23701: error 8: Removed public class android.test.IsolatedContext

frameworks/base/api/current.txt:23706: error 8: Removed public class android.test.LoaderTestCase

frameworks/base/api/current.txt:23711: error 8: Removed public class android.test.MoreAsserts

frameworks/base/api/current.txt:23763: error 8: Removed public class android.test.ProviderTestCase

frameworks/base/api/current.txt:23771: error 8: Removed public class android.test.ProviderTestCase2

frameworks/base/api/current.txt:23779: error 8: Removed public class android.test.RenamingDelegatingContext

frameworks/base/api/current.txt:23788: error 8: Removed public class android.test.ServiceTestCase

frameworks/base/api/current.txt:23801: error 8: Removed public class android.test.SingleLaunchActivityTestCase

frameworks/base/api/current.txt:23807: error 8: Removed public class android.test.SyncBaseInstrumentation

frameworks/base/api/current.txt:23813: error 8: Removed public class android.test.TestSuiteProvider

frameworks/base/api/current.txt:23817: error 8: Removed public class android.test.TouchUtils

frameworks/base/api/current.txt:23855: error 8: Removed public class android.test.ViewAsserts

frameworks/base/api/current.txt:23878: error 7: Removed package android.test.mock

frameworks/base/api/current.txt:24123: error 7: Removed package android.test.suitebuilder

frameworks/base/api/current.txt:32792: error 7: Removed package com.android.internal.util

******************************

You have tried to change the API from what has been previously approved.

To make these errors go away, you have two choices:

1) You can add "@hide" javadoc comments to the methods, etc. listed in the

errors above.

2) You can update current.txt by executing the following command:

make update-api

To submit the revised current.txt to the main Android repository,

you will need approval.

******************************

prebuilts/sdk/api/19.txt:23573: error 8: Removed public class android.test.ActivityInstrumentationTestCase

prebuilts/sdk/api/19.txt:23580: error 8: Removed public class android.test.ActivityInstrumentationTestCase2

prebuilts/sdk/api/19.txt:23588: error 8: Removed public class android.test.ActivityTestCase

prebuilts/sdk/api/19.txt:23595: error 8: Removed public class android.test.ActivityUnitTestCase

prebuilts/sdk/api/19.txt:23620: error 8: Removed public class android.test.AndroidTestRunner

prebuilts/sdk/api/19.txt:23641: error 8: Removed public class android.test.ApplicationTestCase

prebuilts/sdk/api/19.txt:23650: error 8: Removed public class android.test.AssertionFailedError

prebuilts/sdk/api/19.txt:23655: error 8: Removed public class android.test.ComparisonFailure

prebuilts/sdk/api/19.txt:23675: error 8: Removed public class android.test.InstrumentationTestRunner

prebuilts/sdk/api/19.txt:23701: error 8: Removed public class android.test.IsolatedContext

prebuilts/sdk/api/19.txt:23706: error 8: Removed public class android.test.LoaderTestCase

prebuilts/sdk/api/19.txt:23711: error 8: Removed public class android.test.MoreAsserts

prebuilts/sdk/api/19.txt:23763: error 8: Removed public class android.test.ProviderTestCase

prebuilts/sdk/api/19.txt:23771: error 8: Removed public class android.test.ProviderTestCase2

prebuilts/sdk/api/19.txt:23779: error 8: Removed public class android.test.RenamingDelegatingContext

prebuilts/sdk/api/19.txt:23788: error 8: Removed public class android.test.ServiceTestCase

prebuilts/sdk/api/19.txt:23801: error 8: Removed public class android.test.SingleLaunchActivityTestCase

prebuilts/sdk/api/19.txt:23807: error 8: Removed public class android.test.SyncBaseInstrumentation

prebuilts/sdk/api/19.txt:23813: error 8: Removed public class android.test.TestSuiteProvider

prebuilts/sdk/api/19.txt:23817: error 8: Removed public class android.test.TouchUtils

prebuilts/sdk/api/19.txt:23855: error 8: Removed public class android.test.ViewAsserts

prebuilts/sdk/api/19.txt:23878: error 7: Removed package android.test.mock

prebuilts/sdk/api/19.txt:24123: error 7: Removed package android.test.suitebuilder

prebuilts/sdk/api/19.txt:32792: error 7: Removed package com.android.internal.util

******************************

You have tried to change the API from what has been previously released in

an SDK.  Please fix the errors listed above.

******************************

make: *** [out/target/common/obj/PACKAGING/checkapi-last-timestamp] Error 38

期间删除out目录重新编译无效,恢复修改的文件,无效,具体是哪里错误已经搞不清楚了....

按照提示先make update-api,然后重新编译,关于current.txt的错误已经没有了,但是19.txt的错误依旧存在

有说是JAVA环境问题,我的是1.6的没问题,为了防止ubuntu自带的openJDK干扰,卸载了openJDK,依然如故....

既然提示说Removed,那就将19.txt中相关定义对比新生成的current.txt对比删掉吧...

然后编译,在忐忑的心情下竟然编译通过了,时间也就到了现在了....

解决过程极其简单,但是解决这个问题的过程却十分繁琐,网上相关问题几乎没有,google上不去....真无语了,但是是什么造成出现这个问题的到现在我还不明白

之前删了一些framework中的test目录,跟这个有关系?但是我恢复了后也没用,而且是前几天删掉了,问题却是昨天才出现.....

有知道该问题的朋友不妨给我留言

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值