IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 移动开发 -> AndroidStudio编译调试aosp11R 的Launcher3 -> 正文阅读

[移动开发]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

  移动开发 最新文章
Vue3装载axios和element-ui
android adb cmd
【xcode】Xcode常用快捷键与技巧
Android开发中的线程池使用
Java 和 Android 的 Base64
Android 测试文字编码格式
微信小程序支付
安卓权限记录
知乎之自动养号
【Android Jetpack】DataStore
上一篇文章      下一篇文章      查看所有文章
加:2022-03-30 18:36:39  更:2022-03-30 18:38:18 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年9日历 -2024/9/22 23:31:21-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码