正确引入setupdesign和setupcompat的方式

2024-09-06 08:58

本文主要是介绍正确引入setupdesign和setupcompat的方式,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

正确引入setupdesign和setupcompat的方式

引入方式如下:

├── app
│   ├── app.iml
│   ├── assests
│   ├── build
│   ├── build.gradle   // 配置1
│   ├── libs
│   ├── proguard-rules.pro
│   └── src
├── build.gradle
├── TESTX.iml
├── gradle
│   └── wrapper
├── gradle.properties
├── gradlew
├── gradlew.bat
├── local.properties
├── settings.gradle    //  配置2
├── setupcompat
│   ├── Android.bp
│   ├── AndroidManifest.xml
│   ├── build
│   ├── build.gradle
│   ├── TESTX.setupcompat.iml
│   ├── exempting_lint_checks.txt
│   ├── LICENSE
│   ├── lint.xml
│   ├── main
│   ├── METADATA
│   ├── MODULE_LICENSE_APACHE2
│   ├── OWNERS
│   ├── partnerconfig
│   ├── proguard.flags
│   └── setupcompat.iml
├── setupdesign
│   ├── Android.bp
│   ├── build
│   ├── build.gradle
│   ├── TESTX.setupdesign.iml
│   ├── exempting_lint_checks.txt
│   ├── LICENSE
│   ├── lint.xml
│   ├── main
│   ├── METADATA
│   ├── MODULE_LICENSE_APACHE2
│   ├── NOTICE
│   ├── OWNERS
│   ├── proguard.flags
│   ├── setupdesign.iml
│   └── strings

验证环境Android R.

setupdesign和setupcompat来自aosp /external/setupcompat和/external/setupdesign,可以通过gradle引入自有工程。

配置1:

// app/build.gradle
dependencies {implementation fileTree(dir: 'libs', include: ['*.jar'])// 关键implementation project(path: ':setupcompat')implementation project(path: ':setupdesign')implementation "com.google.android.material:material:1.2.0"
}

配置2:

// settings.gracle
rootProject.name='TESTX'
include ':app'
include(':setupdesign')
project(':setupdesign').projectDir = new File(settingsDir, './setupdesign')
include(':setupcompat')
project(':setupcompat').projectDir = new File(settingsDir, './setupcompat')

主工程里边直接引用相关布局即可。

根据setupcompat 导入提示:

//TESTX/setupcompat/build.gradle
/*** Include this gradle file if you are building against this as a standalone gradle library project,* as opposed to building it as part of the git-tree. This is typically the file you want to include* if you create a new project in Android Studio.** For example, you can include the following in your settings.gradle file:*      include ':setupcompat'*      project(':setupcompat').projectDir = new File(PATH_TO_THIS_DIRECTORY)** And then you can include the :setupcompat project as one of your dependencies*      dependencies {*          implementation project(path: ':setupcompat')*      }*/apply plugin: 'com.android.library'android {// Not specifying compileSdkVersion here so clients can specify it; must be at least QcompileSdkVersion 30defaultConfig {minSdkVersion 14targetSdkVersion 30}buildTypes {release {minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.flags'}}sourceSets.main {manifest.srcFile 'AndroidManifest.xml'java.srcDirs = ['main/java', 'partnerconfig/java']aidl.srcDirs = ['main/aidl']res.srcDirs = ['main/res']}compileOptions {sourceCompatibility JavaVersion.VERSION_1_8targetCompatibility JavaVersion.VERSION_1_8}
}dependencies {implementation "androidx.annotation:annotation:1.0.0"
}

针对这个提示:

    // Not specifying compileSdkVersion here so clients can specify it; must be at least Q
    compileSdkVersion 30

本地测试好像不给不行,必须给; 不给sync project直接报错。

A problem occurred configuring project ':setupcompat'.
> compileSdkVersion is not specified.

 

这篇关于正确引入setupdesign和setupcompat的方式的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1141576

相关文章

Java AOP面向切面编程的概念和实现方式

《JavaAOP面向切面编程的概念和实现方式》AOP是面向切面编程,通过动态代理将横切关注点(如日志、事务)与核心业务逻辑分离,提升代码复用性和可维护性,本文给大家介绍JavaAOP面向切面编程的概... 目录一、AOP 是什么?二、AOP 的核心概念与实现方式核心概念实现方式三、Spring AOP 的关

Linux挂载linux/Windows共享目录实现方式

《Linux挂载linux/Windows共享目录实现方式》:本文主要介绍Linux挂载linux/Windows共享目录实现方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地... 目录文件共享协议linux环境作为服务端(NFS)在服务器端安装 NFS创建要共享的目录修改 NFS 配

Vue3视频播放组件 vue3-video-play使用方式

《Vue3视频播放组件vue3-video-play使用方式》vue3-video-play是Vue3的视频播放组件,基于原生video标签开发,支持MP4和HLS流,提供全局/局部引入方式,可监听... 目录一、安装二、全局引入三、局部引入四、基本使用五、事件监听六、播放 HLS 流七、更多功能总结在 v

Java发送SNMP至交换机获取交换机状态实现方式

《Java发送SNMP至交换机获取交换机状态实现方式》文章介绍使用SNMP4J库(2.7.0)通过RCF1213-MIB协议获取交换机单/多路状态,需开启SNMP支持,重点对比SNMPv1、v2c、v... 目录交换机协议SNMP库获取交换机单路状态获取交换机多路状态总结交换机协议这里使用的交换机协议为常

k8s admin用户生成token方式

《k8sadmin用户生成token方式》用户使用Kubernetes1.28创建admin命名空间并部署,通过ClusterRoleBinding为jenkins用户授权集群级权限,生成并获取其t... 目录k8s admin用户生成token创建一个admin的命名空间查看k8s namespace 的

uni-app小程序项目中实现前端图片压缩实现方式(附详细代码)

《uni-app小程序项目中实现前端图片压缩实现方式(附详细代码)》在uni-app开发中,文件上传和图片处理是很常见的需求,但也经常会遇到各种问题,下面:本文主要介绍uni-app小程序项目中实... 目录方式一:使用<canvas>实现图片压缩(推荐,兼容性好)示例代码(小程序平台):方式二:使用uni

Pandas处理缺失数据的方式汇总

《Pandas处理缺失数据的方式汇总》许多教程中的数据与现实世界中的数据有很大不同,现实世界中的数据很少是干净且同质的,本文我们将讨论处理缺失数据的一些常规注意事项,了解Pandas如何表示缺失数据,... 目录缺失数据约定的权衡Pandas 中的缺失数据None 作为哨兵值NaN:缺失的数值数据Panda

Java 中的 equals 和 hashCode 方法关系与正确重写实践案例

《Java中的equals和hashCode方法关系与正确重写实践案例》在Java中,equals和hashCode方法是Object类的核心方法,广泛用于对象比较和哈希集合(如HashMa... 目录一、背景与需求分析1.1 equals 和 hashCode 的背景1.2 需求分析1.3 技术挑战1.4

java读取excel文件为base64实现方式

《java读取excel文件为base64实现方式》文章介绍使用ApachePOI和EasyExcel处理Excel文件并转换为Base64的方法,强调EasyExcel适合大文件且内存占用低,需注意... 目录使用 Apache POI 读取 Excel 并转换为 Base64使用 EasyExcel 处

Spring Boot中获取IOC容器的多种方式

《SpringBoot中获取IOC容器的多种方式》本文主要介绍了SpringBoot中获取IOC容器的多种方式,包括直接注入、实现ApplicationContextAware接口、通过Spring... 目录1. 直接注入ApplicationContext2. 实现ApplicationContextA