Android AGP8.1.0组件化初探

news2024/9/21 14:32:49

Android AGP8.1.0组件化初探

在这里插入图片描述

前言:

前面两篇完成了从AGP4.2到 AGP8.1.0的升级,本文是由于有哥们留言说在AGP8.0中使用ARouter组件化有问题,于是趁休息时间尝试了一下,写了几个demo,发现都没有问题,跳转和传值都是正常的,这里我也是直接从groovy转换成versions-catelog的依赖方式,由于之前升级过,所以这次很顺利,几分钟就完成了,直接上代码:

1.添加统一依赖:

[versions]
agp = "8.1.0"
androidx-espresso-core = "3.4.0"
androidx-junit = "1.1.3"
org-jetbrains-kotlin-android = "1.8.0"
core-ktx = "1.10.1"
junit = "4.13.2"
androidx-test-ext-junit = "1.1.5"
espresso-core = "3.5.1"
appcompat = "1.6.1"
material = "1.9.0"
constraintlayout = "2.1.4"
mmkv = "1.3.1"
utilcodex = "1.31.1"
arouter = "1.5.2"
arouter-compiler = "1.5.2"
org-jetbrains-kotlin-kapt = "1.8.0"

[libraries]
androidx-espresso-core-3_4_0 = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-espresso-core" }
androidx-junit-1_1_3 = { module = "androidx.test.ext:junit", version.ref = "androidx-junit" }
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "core-ktx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-ext-junit" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso-core" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
mmkv = { group = "com.tencent", name = "mmkv", version.ref = "mmkv" }
utilcodex = {group = "com.blankj",name = "utilcodex",version.ref = "utilcodex"}
arouter = {group = "com.alibaba",name = "arouter-api",version.ref = "arouter"}
arouter-compiler = {group = "com.alibaba",name = "arouter-compiler",version.ref = "arouter-compiler"}

[plugins]
com-android-library = { id = "com.android.library", version.ref = "agp" }
com-android-application = { id = "com.android.application", version.ref = "agp" }
org-jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "org-jetbrains-kotlin-android" }
org-jetbrains-kotlin-kapt = {id = "org.jetbrains.kotlin.kapt",version.ref = "org-jetbrains-kotlin-kapt"}

[bundles]

2.添加lib-common组件配置:

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
    alias(libs.plugins.com.android.library)
    alias(libs.plugins.org.jetbrains.kotlin.android)
    alias(libs.plugins.org.jetbrains.kotlin.kapt)
}
dependencies {
    implementation(libs.core.ktx)
    implementation(libs.appcompat)
    implementation(libs.material)
    implementation(libs.arouter)
    kapt(libs.arouter.compiler)
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.test.ext.junit)
    androidTestImplementation(libs.espresso.core)
}

kapt {
    arguments {
        arg("AROUTER_MODULE_NAME", project.name)
    }
}

完整配置:

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
    alias(libs.plugins.com.android.library)
    alias(libs.plugins.org.jetbrains.kotlin.android)
    alias(libs.plugins.org.jetbrains.kotlin.kapt)
}

android {
    namespace = "com.example.lib_cmmon"
    compileSdk = 33

    defaultConfig {
        //applicationId = "com.example.lib_cmmon"
        minSdk = 23
        targetSdk = 33
       // versionCode = 1
       // versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = "17"
    }
}

dependencies {
    implementation(libs.core.ktx)
    implementation(libs.appcompat)
    implementation(libs.material)
    implementation(libs.arouter)
    kapt(libs.arouter.compiler)
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.test.ext.junit)
    androidTestImplementation(libs.espresso.core)
}

kapt {
    arguments {
        arg("AROUTER_MODULE_NAME", project.name)
    }
}

3.lib-common添加ARouter初始化:

/**
 * @author: njb
 * @date: 2023/8/26 22:21
 * @desc:
 */
public class BaseApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        initARouter();
    }

    private void initARouter() {
        ARouter.openDebug();
        ARouter.openLog();
        ARouter.init(this);
    }
}

4.添加lib-arouter组件配置:

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
    alias(libs.plugins.com.android.library)
    alias(libs.plugins.org.jetbrains.kotlin.android)
    alias(libs.plugins.org.jetbrains.kotlin.kapt)
}

android {
    namespace = "com.example.lib_arouter"
    compileSdk = 33

    defaultConfig {
       // applicationId = "com.example.lib_arouter"
        minSdk = 23
        targetSdk = 33
        //versionCode = 1
       // versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
}

dependencies {

    implementation(libs.appcompat)
    implementation(libs.material)
    implementation(libs.constraintlayout)
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.test.ext.junit)
    androidTestImplementation(libs.espresso.core)
    implementation(libs.arouter)
    kapt(libs.arouter.compiler)
    implementation(project(":lib-common"))
}

kapt {
    arguments {
        arg("AROUTER_MODULE_NAME", project.name)
    }
}

5.调用ARouter初始化:

/**
 * @author: njb
 * @date: 2023/8/26 22:21
 * @desc:
 */
public class ARouterApp  extends BaseApp {

    @Override
    public void onCreate() {
        super.onCreate();
    }
}

6.主模块依赖配置:

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
    alias(libs.plugins.com.android.application)
    alias(libs.plugins.org.jetbrains.kotlin.android)
    alias(libs.plugins.org.jetbrains.kotlin.kapt)
}

android {
    namespace =  "com.example.writelogdemo"
    compileSdk = 33

    defaultConfig {
        applicationId  = "com.example.writelogdemo"
        minSdk = 23
        targetSdk = 33
        versionCode = 1
        versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = "17"
    }
}

dependencies {
    implementation(libs.core.ktx)
    implementation(libs.appcompat)
    implementation(libs.material)
    implementation(libs.constraintlayout)
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.test.ext.junit)
    androidTestImplementation(libs.espresso.core)
    implementation(libs.utilcodex)
    implementation(libs.arouter)
    kapt(libs.arouter.compiler)
    implementation(project(":lib-arouter"))
    implementation(project(":lib-common"))
}


7.添加ARouter组件化配置:

7.1 引入ARouter依赖:

这里我用的是catelog方式,所以使用kapt方式

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
    alias(libs.plugins.com.android.library)
    alias(libs.plugins.org.jetbrains.kotlin.android)
    alias(libs.plugins.org.jetbrains.kotlin.kapt)
}

implementation(libs.arouter)
kapt(libs.arouter.compiler)

7.2 添加模块名称配置:

kapt {
    arguments {
        arg("AROUTER_MODULE_NAME", project.name)
    }
}

7.3 主模块ARouter初始化:

/**
 * @author: njb
 * @date: 2023/8/25 22:36
 * @desc:
 */
public class LogApp extends BaseApp {
    private static LogApp mInstance;

    @Override
    public void onCreate() {
        super.onCreate();
        mInstance = this;
    }

    public static LogApp getInstance() {
        return mInstance;
    }
}

7.4 在Activity中绑定Arouter:

ARouter.getInstance().inject(this)

7.5 添加Arouter跳转和传值:

userList = arrayListOf("年龄18","John","身高180","体重60kg","性别female")
tvText.setOnClickListener {
    ARouter.getInstance().build("/test/TestSplashActivity").withString("name","test张三").withSerializable("userList",
        userList
    ).navigation()

7.6 test模块添加跳转路径和数据接收:

@Route(path = "/test/TestSplashActivity")
class TestSplashActivity : AppCompatActivity() {
    val TAG = "TestARouter"

    @Autowired(name = "name")
    @JvmField
    var name: String = ""

    @Autowired(name = "userList")
    @JvmField
    var mList:ArrayList<String> ?= null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_test_splash)
        ARouter.getInstance().inject(this)

        initView()
    }

    private fun initView() {
        tvName.text = "测试ARouter跳转$name"
        tvTextView.text = mList.toString()
    }
}

8.完整使用示例:

package com.example.writelogdemo

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.TextView
import com.alibaba.android.arouter.launcher.ARouter

class MainActivity : AppCompatActivity() {
    private val tvText : TextView by lazy { findViewById(R.id.tvTest) }
    var userList:ArrayList<String> ?= null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        ARouter.getInstance().inject(this)
        userList = arrayListOf("年龄18","John","身高180","体重60kg","性别female")
        tvText.setOnClickListener {
            ARouter.getInstance().build("/test/TestSplashActivity").withString("name","test张三").withSerializable("userList",
                userList
            ).navigation()
        }
    }
}

9.主模块布局:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/tvTest"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

10.lib-arouter测试代码:

package com.example.lib_arouter

import android.annotation.SuppressLint
import android.os.Bundle
import android.util.Log
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter

@SuppressLint("CustomSplashScreen")
@Route(path = "/test/TestSplashActivity")
class TestSplashActivity : AppCompatActivity() {
    val TAG = "TestARouter"
    val tvName:TextView by lazy { findViewById(R.id.tv_name) }
    val tvTextView:TextView by lazy { findViewById(R.id.tv_test) }
    @Autowired(name = "name")
    @JvmField
    var name: String = ""

    @Autowired(name = "userList")
    @JvmField
    var mList:ArrayList<String> ?= null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_test_splash)
        ARouter.getInstance().inject(this)
        Log.d(TAG, "测试ARouter数据传递$name$mList")
        initView()
    }

    private fun initView() {
        tvName.text = name
        tvTextView.text = mList.toString()
    }
}

11.lib-arouter布局代码:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".TestSplashActivity">

    <TextView
        android:id="@+id/tv_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="这是Arouter测试"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/tv_test"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="30dp"
        android:text="这是数组"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/tv_name" />

</androidx.constraintlayout.widget.ConstraintLayout>

12.日志打印如下:

在这里插入图片描述

13.实现效果如下:

在这里插入图片描述

在这里插入图片描述

14.遇到问题:

14.1 测试模块配置不对

由于我是直接新建的模块,所以当作完整项目配置的,这里如果只是测试组件化需要修改配置

在这里插入图片描述

解决方法修改libs.plugins.com.android.application为libs.plugins.com.android.library
在这里插入图片描述

修改完成后可以正常运行:

14.2 跳转时提示path找不到

解决方法:
a.按照上面7中的步骤配置主模块和其他组件模块,一个都不能少。

​b.同时在跳转时保证路径一致即可。

若配置完还有问题,请仔细检查每一步,直到正常跳转和数据传递,本人是亲自尝试了多个项目,基本上都没问题.

14.3 数据传递和接收问题

在这里插入图片描述

解决方法:

a.在kotlin中使用ARouter接收数据时需要使用@JvmField关键字

b.@Autowired(name = “name”),name一定要和传递时一致

c.传递数组时记得序列化,接收也是一样

15.AGP8.1.0小技巧:

15.1 在没有添加统一依赖时配置:

implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.9.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
implementation("com.alibaba:arouter-api:1.5.2")
kapt("com.alibaba:arouter-compiler:1.5.2")
implementation(project(":lib-common"))

15.2 添加统一依赖库配置后:

如果添加了统一的catelog配置方式后导入依赖它会自动提示,不需要开发者手动导入,这点我感觉很爽,一键一直替换,用起来简直不要太安逸了,感兴趣的同学可以自行尝试,这里就简单举例。
在这里插入图片描述
在这里插入图片描述

16.总结:

其实本文的目的不是在于如何使用,ARouter这个很简单,相信做过组件化的同学都会,只是需要遇到问题时学会分析和调试,要不然盲目猜测是不会有结果的。开发这条路任重而道远,希望大家都能上下求索,享受这个求索的过程,痛并快乐着,也很重要,新技术出来可以尝试,也可以根据自己需要调整,不一样说非得更新用这个新技术,只要能解决问题,咋好用咋来。

17.demo地址如下:

https://gitee.com/jackning_admin/write-log-demo

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/948175.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

循环的技巧和深入条件控制

这里对深入条件控制的知识点做一下测试&#xff1a;用作普通值而不是布尔值时&#xff0c;短路运算符的返回值通常是最后一个求了值的参数。 a2c5 for b in [0,1]:print((a and b and c))运行结果 E:\Python\Python38\python.exe D:/pythonprojects/python-auto-test/test/ti…

【MySQL】mysql connect

目录 一、准备工作 1、创建mysql用户 2、删除用户 3、修改用户密码 3.1、自己改自己密码 3.2、root用户修改指定用户的密码 4、数据库的权限 4.1、给用户授权 4.2、回收权限 二、连接mysql client 1、安装mysql客户端库 2、验证是否引入成功 三、 mysql接口 1、初…

Spring boot 整合 Okhttp3 并封装请求工具

一、 为什么要使用okHttp OkHttp是一个高效、灵活、易于使用的HTTP客户端库&#xff0c;优势如下&#xff1a; 性能更高&#xff1a;OkHttp在网络请求处理上采用了异步模型&#xff0c;并将连接池、压缩、网络协议等多种技术应用到其中&#xff0c;从而提高了网络请求的效率和…

c语言每日一练(12)

前言&#xff1a;每日一练系列&#xff0c;每一期都包含5道选择题&#xff0c;2道编程题&#xff0c;博主会尽可能详细地进行讲解&#xff0c;令初学者也能听的清晰。每日一练系列会持续更新&#xff0c;暑假时三天之内必有一更&#xff0c;到了开学之后&#xff0c;将看学业情…

MongoDB实验——在MongoDB集合中查找文档

在MongoDB集合中查找文档 一、实验目的二、实验原理三、实验步骤1.启动MongoDB数据库、启动MongoDB Shell客户端2.数据准备-->person.json3.指定返回的键4 .包含或不包含 i n 或 in 或 in或nin、$elemMatch&#xff08;匹配数组&#xff09;5.OR 查询 $or6.Null、$exists7.…

Vue3 学习 组合式API setup语法糖 响应式 指令 DIFF(一)

文章目录 前言一、Composition Api二、setup语法糖三、响应式refreactive 四、其他一些关键点v-prev-oncev-memov-cloak 五、虚拟Dom五、diff算法 前言 本文用于记录学习Vue3的过程 一、Composition Api 我觉得首先VUE3最大的改变就是对于代码书写的改变&#xff0c;从原来选择…

《自然语言处理》chapter7-预训练语言模型

这是阅读《自然语言处理-基于预训练模型的方法》的学习笔记&#xff0c;记录学习过程&#xff0c;详细的内容请大家购买书籍查阅。 同时参考沐神的两个视频&#xff1a; GPT&#xff0c;GPT-2&#xff0c;GPT-3 论文精读【论文精读】 BERT 论文逐段精读【论文精读】 概述 自然…

如何保证跨境传输的安全性?

随着互联网时代的到来&#xff0c;全球文件传输频率不断增加&#xff0c;市场经济的发展也对信息共享提出更高要求。传统电话交流已无法满足跨国企业的需求&#xff0c;企业内部诸如Web、电子邮件、企业资源计划&#xff08;ERP&#xff09;、网络电话&#xff08;VOIP&#xf…

SAP ABAP 代码调优检查工具及性能调优

一&#xff1a;代码检查工具 ABAP 测试仪表盘(ATC) 所有检查工具, 豁免处理, 结果存储的中心 代码检查器 (SCI) 提供给客户&#xff0c;合作伙伴和SAP的做代码相关检查的开放式架构 扩展程序检查(SLIN) 扩展的代码检查&#xff0c;用来分析源代码 SAP NetWeaver 应用服务器&a…

VMware虚拟机网络连接设置——NAT模式(Windows版)

首先参考VMware虚拟机网络连接设置——仅主机模式&#xff08;Windows版&#xff09;_vmware仅主机模式_Mr.LiuZB的博客-CSDN博客配置&#xff0c;网络还是不通&#xff0c;再结合Linux 虚拟机和主机互通 [万能方法]_linux虚拟机与主机网络连接_核桃胡子的博客-CSDN博客 配置&…

AD域中批量添加域用户

首先在C盘中建立一个文件&#xff0c;名字为file.csv 格式如下 根据CSV文件的ABCDE列来进行识别的 然后我们在cmd命令行中输入一下命令 for /f "tokens1,2,3,4,5 delims," %a in (C:file.csv) do dsadd user "cn%c,ou业务部,ou博迈科技,dcBMKJ,dccom" -s…

Qt应用开发(基础篇)——消息对话框 QMessageBox

一、前言 QMessageBox类继承于QDialog&#xff0c;是一个模式对话框&#xff0c;常用于通知用户或向用户提出问题并接收答案。 对话框QDialog QMessageBox消息框主要由四部分组成&#xff0c;一个主要文本text&#xff0c;用于提醒用户注意某种情况;一个信息文本informativeTex…

linux c编程之“hello world”一

文章目录 hello world开始学习汇编文件 hello.s第1行第2行第3行第4行第5行第6行第7行第8行第9行第10行第11行第12行第13行 X [注]&#xff1a;环境说明&#xff1a; OS&#xff1a;CentOS 7 GCC&#xff1a; 4.8.5 其他环境下的结果可能不尽相同。 声明&#xff1a;本文是我的一…

10年前的显卡 NVIDIA_Quadro_FX_5800

NVIDIA_Quadro_FX_5800 主要参数核心频率610 MHzTurbo频率流处理单元240 个核心架构Tesla 2.0 共71款GPU代号GT200B生产工艺55 nmTDP功耗189W 内存参数内存频率1600 Mbps内存类型GDDR3内存位宽512 bit最大显存4 GB 参数补充晶体管数量1,400 million代工厂TSMC核心面积470 mm二…

python web 开发与 Node.js + Express 创建web服务器入门

目录 1. Node.js Express 框架简介 2 Node.js Express 和 Python 创建web服务器的对比 3 使用 Node.js Express 创建web服务器示例 3.1 Node.js Express 下载安装 3.2 使用Node.js Express 创建 web服务器流程 1. Node.js Express 框架简介 Node.js Express 是一种…

无涯教程-Android Intent Standard Extra Data函数

下表列出了各种重要的Android Intent Standard Extra Data。您可以查看Android官方文档以获取额外数据的完整列表- Sr.NoExtra Data & Description1 EXTRA_ALARM_COUNT 用作AlarmManager intents(意图)中的int Extra字段,以告诉正在调用的应用程序intents(意图)释放了多少…

java八股文面试[多线程]——指令重排序

关于a的操作&#xff0c;由原来的6个指令&#xff0c;变成了4个指令。 1. 指令重排序的介绍 1&#xff09;指令重排序的类型 在执行程序时为了提高性能&#xff0c;编译器和处理器常常会对指令做重排序。 重排序分三种类型&#xff1a;编译器优化的重排序 编译器在不改变单线…

深度分析:如何轻松掌握文件大小管理

大家好&#xff0c;今天我要与大家分享一个实用至极的脚本。简单易用&#xff0c;但效果却让人惊艳。它可以在几秒钟内完成文件大小的统计&#xff0c;并生成一份统计信息。 功能概览 完整性分析&#xff1a;一次性告诉你不同大小区间的文件分布&#xff0c;让你一目了然。 速…

【Unity】常见的角色移动旋转

在Unity 3D游戏引擎中&#xff0c;可以使用不同的方式对物体进行旋转。以下是几种常见的旋转方式&#xff1a; 欧拉角&#xff08;Euler Angles&#xff09;&#xff1a;欧拉角是一种常用的旋转表示方法&#xff0c;通过绕物体的 X、Y 和 Z 轴的旋转角度来描述物体的旋转。在Un…

七、MySQL(DML)如何往表中添加数据?

1、基础语法&#xff1a; &#xff08;1&#xff09;一对一添加数据&#xff1a; 一次只能添加一组数据&#xff0c;可以指定对应字段 insert into 表名 (字段名1,字段名2,……) values (数值1.数值2&#xff0c;……) &#xff08;2&#xff09;给全部字段添加数据&#…