Android9.0 原生Launcher3 Androidstdio编译分享

最近在公司有修改原生Launcher3的UI,在服务器端不能实时预览,修改验证比较麻烦,所以把Launcher3的源码拿到本地进行编译

刚拿下来遇到以下问题点报错:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\azxjq\Desktop\Launcher3\build.gradle' line: 15

* What went wrong:
A problem occurred evaluating root project 'Launcher3'.
> Failed to apply plugin [id 'com.google.protobuf']
> Could not create an instance of type com.google.protobuf.gradle.ProtobufSourceDirectorySet.
> org.gradle.api.internal.file.DefaultSourceDirectorySet.<init>(Ljava/lang/String;Ljava/lang/String;Lorg/gradle/api/internal/file/FileResolver;Lorg/gradle/api/internal/file/collections/DirectoryFileTreeFactory;)V

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================


第一处报错 Failed to apply plugin [id 'com.google.protobuf' 这里未能应用插com.google.protobuf的原因是因为对版本有要求

protobuf-gradle-plugin 的版本至少在0.8.13,Gradle的最低版本 5.6 and Java最低8以上。

因此只需更新使用版本。

buildscript {
        repositories {
                mavenCentral()
                google()
        }
        dependencies {
                classpath 'com.android.tools.build:gradle:3.2.0-alpha12'
                classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.13'
        }

}

 解决完以后继续build:

A problem occurred evaluating root project 'Launcher3'.
> ASCII

出现此问题的原因是build.gradle里面的版本和我本地不一致,修改一下版本,这里根据自己本地的版本修改

dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.13'
}

 接下来遇到一下报错:

Execution failed for task ':preAospDebugBuild'.
> Could not resolve all files for configuration ':aospDebugCompileClasspath'.
> Could not find com.android.support:support-v4:28.0.0-SNAPSHOT.
Required by:
project :
> Could not find com.android.support:support-dynamic-animation:28.0.0-SNAPSHOT.
Required by:
project :
> Could not find com.android.support:recyclerview-v7:28.0.0-SNAPSHOT.
Required by:
project :

Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
 

一开始我以为这里是因为网络的问题,导致所需要的的jar包下载不下来,后来我发现后面加一个SNAPSHOT是什么鬼 ,我果断删除继续build。

import android.content.pm.IPackageDeleteObserver;
^
符号: 类 IPackageDeleteObserver
位置: 程序包 android.content.pm

filter_HOST.addAction(WifiManager.WIFI_AP_STATE_CHANGED_ACTION);
^
符号: 变量 WIFI_AP_STATE_CHANGED_ACTION
位置: 类 WifiManager

现在报到具体代码的错误,报的错误远不止我贴出来的这么多,这些都是因为我们系统添加了自己的API,android标准的sdk自然找不到我们新增的api,那么这个问题怎么解决呢。

我们可以自己编译出jar包,通过修改app.iml的方式,优先使用我们的jar。

具体方式可以参考链接这里 

后面就是还有因为launcher加了

android:sharedUserId="android.uid.system"

 因为我们需要我们自己系统的签名文件,配置以后就可以正常运行了。

  • 4
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值