AndroidStudio编译调试aosp11R 的Launcher3

1.下载aosp并编译

2.下载Launcher3
可以直接使用aosp中的,也可以使用git单独下载

git clone https://android-review.googlesource.com/platform/packages/apps/Launcher3.git

可以使用国内镜像下载,使用中科大源

git clone git://mirrors.ustc.edu.cn/aosp/platform/packages/apps/Launcher3.git

在这里插入图片描述

#查看tag
git tag
#git checkout切换到自己aosp的分支,我的是android-11.0.0_r40
git checkout android-11.0.0_r40

在这里插入图片描述
3.用AndroidStudio打开

修改gralde.properties,将COMPILE_SDK=android-R改为android-30

# Until all the dependencies move to android X
android.useAndroidX = true
android.enableJetifier = true

ANDROID_X_VERSION=1+

GRADLE_CLASS_PATH=com.android.tools.build:gradle:3.5.1

PROTOBUF_CLASS_PATH=com.google.protobuf:protobuf-gradle-plugin:0.8.8
PROTOBUF_DEPENDENCY=com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7

BUILD_TOOLS_VERSION=28.0.3
COMPILE_SDK=android-30

No matching configuration of project :IconLoader was found. The consumer was configured to find an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'app' with value 'aosp', attribute 'recents' with value 'withoutQuickstep', attribute 'com.android.build.gradle.internal.dependency.AndroidTypeAttr' with value 'Aar' but:

注释掉

//    implementation project(':IconLoader')
错误: 找不到符号
import com.android.launcher3.icons.DotRenderer;

错误: 找不到符号
import com.android.launcher3.icons.IconNormalizer;
错误: 程序包com.android.launcher3.logger.LauncherAtom不存在
错误: 找不到符号
import com.android.systemui.plugins.PluginListener;
错误: 程序包com.google.protobuf.nano不存在
      com.google.protobuf.nano.MessageNano

将aosp-11-2/out/target/common/obj/JAVA_LIBRARIES/Launcher3CommonDepsLib_intermediates下的classes.jar,重命名为Launcher3CommonDepsLib.jar,导入AndroidStudio
添加依赖

implementation files('libs/Launcher3CommonDepsLib.jar')

类重复

Duplicate class android.support.v4.app.RemoteActionCompatParcelizer found in modules classes.jar (androidx.core:core:1.6.0) and jetified-Launcher3CommonDepsLib.jar (Launcher3CommonDepsLib.jar)
Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules classes.jar (androidx.core:core:1.6.0) and jetified-Launcher3CommonDepsLib.jar (Launcher3CommonDepsLib.jar)
Duplicate class android.support.v4.os.ResultReceiver found in modules classes.jar (androidx.core:core:1.6.0) and jetified-Launcher3CommonDepsLib.jar (Launcher3CommonDepsLib.jar)
Duplicate class android.support.v4.os.ResultReceiver$1 found in modules classes.jar (androidx.core:core:1.6.0) and jetified-Launcher3CommonDepsLib.jar (Launcher3CommonDepsLib.jar)

注释掉

//    implementation "androidx.dynamicanimation:dynamicanimation:${ANDROID_X_VERSION}"
//    implementation "androidx.recyclerview:recyclerview:1.1.0"
//    implementation "androidx.preference:preference:${ANDROID_X_VERSION}"

可以运行了
4.编译运行,我这里是运行到api25的模拟器上。

Could not identify launch activity: Default Activity not found
Error while Launching activity
Failed to launch an application on all devices

AndroidManifest.xml的com.android.launcher3.Launcher 添加

<category android:name="android.intent.category.LAUNCHER"/>
 at com.android.launcher3.Utilities.<clinit>(Utilities.java:107)
        at com.android.launcher3.config.FeatureFlags.getDebugFlag(FeatureFlags.java:275)
        at com.android.launcher3.config.FeatureFlags.<clinit>(FeatureFlags.java:67)
        at com.android.launcher3.LauncherProvider.onCreate(LauncherProvider.java:126)

注释掉,日志信息

//        if (FeatureFlags.IS_STUDIO_BUILD) {
//            Log.d(TAG, "Launcher process started");
//        }
at com.android.launcher3.Utilities.<clinit>(Utilities.java:107)
        at com.android.launcher3.config.FeatureFlags.getDebugFlag(FeatureFlags.java:275)
        at com.android.launcher3.config.FeatureFlags.<clinit>(FeatureFlags.java:67)
        at com.android.launcher3.LauncherProvider.onCreate(LauncherProvider.java:126)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)

修改Utilities.java:107

public static final Person[] EMPTY_PERSON_ARRAY = null;
at com.android.launcher3.qsb.QsbContainerView.getSearchWidgetProviderInfo(QsbContainerView.java:98)
        at com.android.launcher3.qsb.QsbContainerView$QsbFragment.getSearchWidgetProvider(QsbContainerView.java:329)
        at com.android.launcher3.qsb.QsbContainerView$QsbFragment.createQsb(QsbContainerView.java:195)
        at com.android.launcher3.qsb.QsbContainerView$QsbFragment.onCreateView(QsbContainerView.java:189)

修改QsbContainerView.java:98

appWidgetManager.getInstalledProviders()

现在可以运行了
在这里插入图片描述
在这里插入图片描述

可以的代码:https://gitee.com/aaaa_sss/launcher3

  • 4
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
要在Android Studio中导入Android Launcher3项目,你需要进行以下步骤: 1. 在build.gradle文件中,将Launcher3CommonDepsLib的依赖项更改为api project(path: ':Launcher3ResLib')。这将确保正确引用Launcher3ResLib模块。\[1\] 2. 在AndroidManifest.xml文件的com.android.launcher3.Launcher活动中添加<category android:name="android.intent.category.LAUNCHER"/>。这将确保应用程序在启动时显示在设备的应用程序列表中。\[2\] 3. 如果遇到android.os包不到的问题,可能是由于缺少相关的依赖项。请确保在build.gradle文件中正确引用了所需的依赖项。 4. 如果遇到Utilities类的问题,可以尝试注释掉Utilities.java文件中的相关代码。例如,注释掉Utilities.java文件中的以下代码行:// if (FeatureFlags.IS_STUDIO_BUILD) { // Log.d(TAG, "Launcher process started"); // }。这可能会解决Utilities类的初始化问题。\[3\] 请按照上述步骤导入Android Launcher3项目,并确保在导入过程中解决任何依赖项或错误。 #### 引用[.reference_title] - *1* [android12.0(S) Launcher3 导入 AndroidStudio 调试编译](https://blog.csdn.net/u012932409/article/details/128772883)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [AndroidStudio编译调试aosp11RLauncher3](https://blog.csdn.net/qq_41285455/article/details/123803291)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值