[CocosCreator]Android的增加AndroidX的動態權限

?????????歡迎喜歡或者從事CocosCreator開發的小伙伴請加入我的大家庭CocosCreator游戲開發Q群:26855530

1.首先增加你需要申請的權限,修改:AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"package="com.xxxx.xxx"android:installLocation="auto"><uses-feature android:glEsVersion="0x00020000" /><uses-permission android:name="android.permission.INTERNET" /><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /><uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /><!--    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />-->
<!--    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />--><!-- Android 13 特殊權限 --><uses-permission android:name="android.permission.POST_NOTIFICATIONS" /><applicationandroid:allowBackup="true"android:label="@string/app_name"android:usesCleartextTraffic="true"android:icon="@mipmap/ic_launcher"android:supportsRtl="true"><!-- Tell Cocos2dxActivity the name of our .so --><meta-data android:name="android.app.lib_name"android:value="cocos2djs" /><activityandroid:name="org.cocos2dx.javascript.AppActivity"android:screenOrientation="sensorLandscape"android:configChanges="orientation|keyboardHidden|screenSize|screenLayout|uiMode"android:theme="@android:style/Theme.NoTitleBar.Fullscreen"android:launchMode="singleTask"android:exported="true"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter></activity></application></manifest>

2. 確保你使用的是AndroidX

確保項目的 gradle.properties 文件中包含如下配置:

# Project-wide Gradle settings.# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true# Android SDK version that will be used as the compile project
PROP_COMPILE_SDK_VERSION=33# Android SDK version that will be used as the earliest version of android this application can run on
PROP_MIN_SDK_VERSION=26# Android SDK version that will be used as the latest version of android this application has been tested on
PROP_TARGET_SDK_VERSION=33# Android Build Tools version that will be used as the compile project
PROP_BUILD_TOOLS_VERSION=28.0.3# List of CPU Archtexture to build that application with
# Available architextures (armeabi-v7a | arm64-v8a | x86)
# To build for multiple architexture, use the `:` between them
# Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86_64
PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86_64# fill in sign information for release mode
RELEASE_STORE_FILE=/Applications/Cocos/Creator/2.4.10/CocosCreator.app/Contents/Resources/static/build-templates/native/debug.keystore
RELEASE_STORE_PASSWORD=123456
RELEASE_KEY_ALIAS=debug_keystore
RELEASE_KEY_PASSWORD=123456android.injected.testOnly=false# android.enableJetifier=trueandroid.useAndroidX=true
android.enableJetifier=true

3. 更新 build.gradle 文件

在你的項目的 build.gradle 文件中,確保包含了AndroidX庫的依賴項:

import org.apache.tools.ant.taskdefs.condition.Osapply plugin: 'com.android.application'
apply plugin: 'kotlin-android'android {compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()buildToolsVersion PROP_BUILD_TOOLS_VERSIONdefaultConfig {applicationId "com.zhcj.xzjh"minSdkVersion PROP_MIN_SDK_VERSIONtargetSdkVersion PROP_TARGET_SDK_VERSIONversionCode 1versionName "1.0"externalNativeBuild {ndkBuild {if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {// skip the NDK Build step if PROP_NDK_MODE is nonetargets 'cocos2djs'arguments 'NDK_TOOLCHAIN_VERSION=clang'def module_paths = [project.file("../../../cocos2d-x"),project.file("../../../cocos2d-x/cocos"),project.file("../../../cocos2d-x/external")]if (Os.isFamily(Os.FAMILY_WINDOWS)) {arguments 'NDK_MODULE_PATH=' + module_paths.join(";")}else {arguments 'NDK_MODULE_PATH=' + module_paths.join(':')}arguments '-j' + Runtime.runtime.availableProcessors()}}ndk {abiFilters PROP_APP_ABI.split(':')}}}sourceSets.main {java.srcDirs "../src", "src"res.srcDirs "../res", 'res'jniLibs.srcDirs "../libs", 'libs'manifest.srcFile "AndroidManifest.xml"}externalNativeBuild {ndkBuild {if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) {// skip the NDK Build step if PROP_NDK_MODE is nonepath "jni/Android.mk"}}}signingConfigs {release {if (project.hasProperty("RELEASE_STORE_FILE")) {storeFile file(RELEASE_STORE_FILE)storePassword RELEASE_STORE_PASSWORDkeyAlias RELEASE_KEY_ALIASkeyPassword RELEASE_KEY_PASSWORD}}}buildTypes {release {debuggable falsejniDebuggable falserenderscriptDebuggable falseminifyEnabled trueshrinkResources trueproguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'if (project.hasProperty("RELEASE_STORE_FILE")) {signingConfig signingConfigs.release}externalNativeBuild {ndkBuild {arguments 'NDK_DEBUG=0'}}}debug {debuggable truejniDebuggable truerenderscriptDebuggable trueexternalNativeBuild {ndkBuild {arguments 'NDK_DEBUG=1'}}}}
}android.applicationVariants.all { variant ->// delete previous files firstdelete "${buildDir}/intermediates/merged_assets/${variant.dirName}"variant.mergeAssets.doLast {def sourceDir = "${buildDir}/../../../../.."copy {from "${sourceDir}"include "assets/**"include "src/**"include "jsb-adapter/**"into outputDir}copy {from "${sourceDir}/main.js"from "${sourceDir}/project.json"into outputDir}}
}dependencies {implementation fileTree(dir: '../libs', include: ['*.jar','*.aar'])implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])implementation fileTree(dir: "../../../cocos2d-x/cocos/platform/android/java/libs", include: ['*.jar'])implementation project(':libcocos2dx')implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"implementation 'androidx.core:core-ktx:1.10.1'implementation 'androidx.appcompat:appcompat:1.6.1'
}

確保在項目級別的 build.gradle 文件中包含Google的Maven倉庫:

// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript {ext.kotlin_version = '1.8.10' // 確保使用最新的 Kotlin 版本repositories {google()jcenter()}dependencies {//        classpath 'com.android.tools.build:gradle:7.1.2'classpath 'com.android.tools.build:gradle:7.4.2' // Android Gradle 插件版本classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"// NOTE: Do not place your application dependencies here; they belong// in the individual module build.gradle files}
}allprojects {repositories {google()jcenter()flatDir {dirs 'libs'}}
}task clean(type: Delete) {delete rootProject.buildDir
}

兩外附上一個監聽網絡工具類:

package org.cocos2dx.javascript.utils;import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.net.NetworkInfo;
import android.os.Build;public class NetworkUtil {private Context context;public NetworkUtil(Context context) {this.context = context;}public boolean isWiFiAvailable() {ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);NetworkInfo activeNetwork = cm.getActiveNetworkInfo();return activeNetwork != null && activeNetwork.isConnected() && activeNetwork.getType() == ConnectivityManager.TYPE_WIFI;}public void useWiFiThenMobile(final NetworkCallback callback) {final ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);NetworkRequest.Builder builder = new NetworkRequest.Builder();builder.addTransportType(NetworkCapabilities.TRANSPORT_WIFI);cm.registerNetworkCallback(builder.build(), new ConnectivityManager.NetworkCallback() {@Overridepublic void onAvailable(Network network) {// WiFi is availableif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {cm.bindProcessToNetwork(network);} else {ConnectivityManager.setProcessDefaultNetwork(network);}callback.onNetworkSelected(true);}@Overridepublic void onUnavailable() {// WiFi is not available, use mobile datacm.unregisterNetworkCallback(this);useMobileData(callback);}});}private void useMobileData(NetworkCallback callback) {ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);NetworkRequest.Builder builder = new NetworkRequest.Builder();builder.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR);cm.requestNetwork(builder.build(), new ConnectivityManager.NetworkCallback() {@Overridepublic void onAvailable(Network network) {// Mobile data is availableif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {cm.bindProcessToNetwork(network);} else {ConnectivityManager.setProcessDefaultNetwork(network);}callback.onNetworkSelected(false);}});}public interface NetworkCallback {void onNetworkSelected(boolean isWiFi);}
}

主角登場AppActivity.java:

package org.cocos2dx.javascript;import org.cocos2dx.javascript.utils.NetworkUtil;
import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;import android.os.Bundle;import android.content.Intent;
import android.content.res.Configuration;import android.Manifest;import android.content.pm.PackageManager;
import android.os.Build;import android.util.Log;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;public class AppActivity extends Cocos2dxActivity {private static final int PERMISSION_REQUEST_CODE = 1;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);// DO OTHER INITIALIZATION BELOWSDKWrapper.getInstance().init(this);// 檢查并請求權限checkAndRequestPermissions();}private void checkAndRequestPermissions() {boolean internetPermission = ContextCompat.checkSelfPermission(this, Manifest.permission.INTERNET) == PackageManager.PERMISSION_GRANTED;boolean networkStatePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_NETWORK_STATE) == PackageManager.PERMISSION_GRANTED;boolean wifiStatePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_WIFI_STATE) == PackageManager.PERMISSION_GRANTED;
//            boolean readStoragePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
//            boolean writeStoragePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { // Android 13boolean notificationPermission = ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED;if (!notificationPermission || !internetPermission || !networkStatePermission || !wifiStatePermission//|| !readStoragePermission || !writeStoragePermission) {ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.INTERNET,Manifest.permission.ACCESS_NETWORK_STATE,Manifest.permission.ACCESS_WIFI_STATE,//Manifest.permission.READ_EXTERNAL_STORAGE,//Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.POST_NOTIFICATIONS}, PERMISSION_REQUEST_CODE);}} else {if (!internetPermission || !networkStatePermission || !wifiStatePermission//|| !readStoragePermission || !writeStoragePermission) {ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.INTERNET,Manifest.permission.ACCESS_NETWORK_STATE,Manifest.permission.ACCESS_WIFI_STATE,
//                            Manifest.permission.READ_EXTERNAL_STORAGE,
//                            Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE);}}}@Overridepublic void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {super.onRequestPermissionsResult(requestCode, permissions, grantResults);if (requestCode == PERMISSION_REQUEST_CODE) {boolean allPermissionsGranted = true;for (int result : grantResults) {if (result != PackageManager.PERMISSION_GRANTED) {allPermissionsGranted = false;break;}}if (allPermissionsGranted) {
//                Toast.makeText(this, "所有權限已授予", Toast.LENGTH_SHORT).show();initializeNetworkUtil();} else {Toast.makeText(this, "權限被拒絕,程序即將關閉", Toast.LENGTH_SHORT).show();finish();  // 關閉程序//另一種關閉程序方式
//                finishAffinity();
//                System.exit(0);}}}private void initializeNetworkUtil() {NetworkUtil networkUtil = new NetworkUtil(this);networkUtil.useWiFiThenMobile(isWiFi -> {// Do something based on network selectionif (isWiFi) {Log.d("NetworkUtil", "Connected to WiFi. Starting download service...");
//                startDownloadService();} else {// 用戶已連接到移動數據網絡// 可以提示用戶注意流量消耗Log.d("NetworkUtil", "Connected to mobile data. Be cautious of data usage.");showMobileDataWarning();}});}private void showMobileDataWarning() {// 顯示移動數據警告的代碼}@Overridepublic Cocos2dxGLSurfaceView onCreateView() {Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);// TestCpp should create stencil bufferglSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);SDKWrapper.getInstance().setGLSurfaceView(glSurfaceView, this);return glSurfaceView;}@Overrideprotected void onResume() {super.onResume();SDKWrapper.getInstance().onResume();// 每次恢復活動時,檢查權限是否被授予boolean internetPermission = ContextCompat.checkSelfPermission(this, Manifest.permission.INTERNET) == PackageManager.PERMISSION_GRANTED;boolean networkStatePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_NETWORK_STATE) == PackageManager.PERMISSION_GRANTED;boolean wifiStatePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_WIFI_STATE) == PackageManager.PERMISSION_GRANTED;
//            boolean readStoragePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
//            boolean writeStoragePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;//                        || !readStoragePermission || !writeStoragePermission// 重新請求權限if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { // Android 13boolean notificationPermission = ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED;}if (!internetPermission || !networkStatePermission || !wifiStatePermission
//                        || !readStoragePermission || !writeStoragePermission || !notificationPermission) {checkAndRequestPermissions();  // 重新請求權限}}@Overrideprotected void onPause() {super.onPause();SDKWrapper.getInstance().onPause();}@Overrideprotected void onDestroy() {super.onDestroy();// Workaround in https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508if (!isTaskRoot()) {return;}SDKWrapper.getInstance().onDestroy();}@Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data) {super.onActivityResult(requestCode, resultCode, data);SDKWrapper.getInstance().onActivityResult(requestCode, resultCode, data);}@Overrideprotected void onNewIntent(Intent intent) {super.onNewIntent(intent);SDKWrapper.getInstance().onNewIntent(intent);}@Overrideprotected void onRestart() {super.onRestart();SDKWrapper.getInstance().onRestart();}@Overrideprotected void onStop() {super.onStop();SDKWrapper.getInstance().onStop();}@Overridepublic void onBackPressed() {SDKWrapper.getInstance().onBackPressed();super.onBackPressed();}@Overridepublic void onConfigurationChanged(Configuration newConfig) {SDKWrapper.getInstance().onConfigurationChanged(newConfig);super.onConfigurationChanged(newConfig);}@Overrideprotected void onRestoreInstanceState(Bundle savedInstanceState) {SDKWrapper.getInstance().onRestoreInstanceState(savedInstanceState);super.onRestoreInstanceState(savedInstanceState);}@Overrideprotected void onSaveInstanceState(Bundle outState) {SDKWrapper.getInstance().onSaveInstanceState(outState);super.onSaveInstanceState(outState);}@Overrideprotected void onStart() {SDKWrapper.getInstance().onStart();super.onStart();}
}

然后就ok,打包拉~

補上我項目的ndk版本:26.3.11579264

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/13424.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/13424.shtml
英文地址,請注明出處:http://en.pswp.cn/web/13424.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

深度學習之基于TensorFlow人臉表情識別

歡迎大家點贊、收藏、關注、評論啦 &#xff0c;由于篇幅有限&#xff0c;只展示了部分核心代碼。 文章目錄 一項目簡介 二、功能三、系統四. 總結 一項目簡介 一、項目背景 人臉表情識別是計算機視覺領域的重要研究方向之一&#xff0c;它在人機交互、情感分析、安全監控等領…

代碼隨想錄35期Day48-Java

Day48題目 LeetCode121買股票的最佳時機1 核心思想:可以使用貪心,選擇左邊最小的和右邊最大的,也可以動態規劃,需要保存是否持有股票的狀態,dp[i][0]表示第i天,不持有股票,dp[i][1]表示第i天持有 class Solution {public int maxProfit(int[] prices) {int[][] dp new int[…

python中異步io簡單樣例

目錄 一、異步IO簡單說明 二、代碼樣例 一、異步IO簡單說明 當進行異步 IO 操作時&#xff0c;程序不會因為等待 IO 操作完成而阻塞&#xff0c;而是可以在等待過程中繼續執行其他任務&#xff0c;從而提高了程序的并發性能和響應速度。這是因為異步 IO 操作利用了操作系統底層…

Java 變量和作用域:理解變量的聲明、初始化及其作用域

在Java編程語言中&#xff0c;變量和作用域是兩個核心概念。理解變量的聲明、初始化以及它們的作用域對于編寫健壯且高效的代碼至關重要。 變量的聲明與初始化 變量的聲明 在Java中&#xff0c;變量的聲明指的是定義變量的名稱和類型。在Java中&#xff0c;變量聲明的一般語…

ESP32開發——關于ESP32TimerInterrupt庫的例程分析

最近在學習嵌入式開發的內容&#xff0c;正好有一個開發任務涉及到對于定時器中斷的使用&#xff0c;今天正好找到了這個相關的庫&#xff1a;ESP32TimerInterrupt ESP32TimerInterrupt庫的下載鏈接&#xff08;適用于Arduino IDE&#xff09; 進入到這個地址后直接下載該庫的…

ubuntu使用記錄——如何使用wireshark網絡抓包工具進行檢測速騰激光雷達的ip和端口號

提示&#xff1a;文章寫完后&#xff0c;目錄可以自動生成&#xff0c;如何生成可參考右邊的幫助文檔 文章目錄 前言wireshark網絡抓包工具1.wireshark的安裝2.wireshark的使用3.更改雷達ip 總結 前言 Wireshark是一款備受贊譽的開源網絡協議分析軟件&#xff0c;其功能之強大…

簡述MyBatis中#{}引用和${}引用的區別

各位大佬光臨寒舍&#xff0c;希望各位能賞臉給個三連&#xff0c;謝謝各位大佬了&#xff01;&#xff01;&#xff01; 目錄 1.有無預編譯 優點 缺點 2.SQL執行的快慢 3.能否被SQL注入 4.參數輸入方式 5.總結 1.有無預編譯 #{}是有預編譯的而${}是沒有預編譯的&…

LiveGBS流媒體平臺GB/T28181用戶手冊-服務器概覽:通道信息、負載信息、CPU使用、存儲使用、帶寬使用(Mbps)、內存使用

LiveGBS用戶手冊-服務器概覽&#xff1a;通道信息、負載信息、CPU使用、存儲使用、帶寬使用&#xff08;Mbps&#xff09;、內存使用 1、服務器概覽1.1、通道信息1.2、負載信息1.2.1、信息說明1.2.2、會話列表 1.3、CPU使用1.4、存儲使用1.5、帶寬使用&#xff08;Mbps&#xf…

15:00面試,15:08出來,面試問的有點變態。。。。

&#x1f345; 視頻學習&#xff1a;文末有免費的配套視頻可觀看 &#x1f345; 點擊文末小卡片&#xff0c;免費獲取軟件測試全套資料&#xff0c;資料在手&#xff0c;漲薪更快 從小廠出來&#xff0c;沒想到在另一家公司又寄了。 到這家公司開始上班&#xff0c;加班是每天…

C語言查漏補缺學習【精簡版】

1.scanf函數 scanf&#xff08;"%d %d"&#xff09;//1 2 scanf("price%d %d") //price1 2 // 意思就是scanf函數中&#xff0c;格式是什么&#xff0c;就要對應的輸入什么&#xff0c;不然讀取不到輸入的變量2.常量&#xff1a;const int AMOUNT 100; …

github下載代碼

clone代碼 git clone https://<your_token>github.com//.git 設置URL git remote set-url origin https://<your_token>github.com//.git 設置github本地ip https://juejin.cn/post/7350880189836918820?searchId202405191828091DB64DD476DF0AEC7442

掌握Edge瀏覽器的使用技巧

導言&#xff1a; Edge瀏覽器是微軟推出的一款現代化、高效的網絡瀏覽器。它不僅提供了基本的瀏覽功能&#xff0c;還具備了許多強大的特性和技巧&#xff0c;可以幫助用戶更好地利用瀏覽器進行工作和娛樂。本文將介紹一些Edge瀏覽器的使用技巧&#xff0c;幫助讀者更好地掌握這…

阿里云數據庫 SelectDB 版全面商業化,開啟現代化實時數據倉庫的全新篇章

2024 年 5 月 21 日&#xff0c;由阿里云聯合飛輪科技共同舉辦的「阿里云數據庫 SelectDB 版商業化產品發布會」于線上召開。阿里巴巴集團副總裁、阿里云數據庫產品事業部負責人李飛飛宣布&#xff0c;阿里云數據庫 SelectDB 版在中國站及國際站全面發布&#xff0c;正式開啟商…

集合-1 數組ArrayListLinkedList

一.數組 1.什么是數組&#xff1f; 數組是一種用連續的內存空間存儲相同類型數據的線性數據結構。 2.為什么數組下標是從0開始&#xff1f; &#xff08;1&#xff09;數組根據下標查找元素是基于尋址公式&#xff1a;元素地址數組首地址索引i*數組存儲數據類型的大小 &am…

ROS | 用C++和python實現運動控制功能

基礎知識&#xff1a; 用C實現&#xff1a; C代碼&#xff1a; 用python實現&#xff1a; Python代碼&#xff1a;

數據庫理論基本概念

數據庫理論基本概念 三級模式和兩級映像 外模式 > 用戶和數據庫系統的接口 -------- 外模式-概念模式映射 概念模式 > 數據的邏輯結構和特征的描述 -------- 概念模式-內模式映射 內模式 > 數據物理結構和存儲方式的描述三級…

避雷:搭建ai知識庫的6大注意事項

隨著人工智能技術的發展&#xff0c;ai知識庫成為眾多企業追求的一個重要部分&#xff0c;幫助企業提高運營次效率&#xff0c;越來越受到人們的關注。但是&#xff0c;在搭建ai知識庫的過程中&#xff0c;稍不留意&#xff0c;就會漏掉一些小細節&#xff0c;導致做出來的ai知…

【LeetCode】438.找到字符串中所有字母異位詞

找到字符串中所有字母異位詞 題目描述&#xff1a; 給定兩個字符串 s 和 p&#xff0c;找到 s 中所有 p 的 異位詞 的子串&#xff0c;返回這些子串的起始索引。不考慮答案輸出的順序。 異位詞 指由相同字母重排列形成的字符串&#xff08;包括相同的字符串&#xff09;。 示…

Scala學習筆記4: 數組

目錄 第四章1- 定長數組2- 變長數組3- 遍歷數組和數組緩存4- 數組轉換5- 常用算法6- 多維數組end 第四章 1- 定長數組 在Scala中, 定長數組可以使用 Array 類來創建; 定長數組在創建時需要指定數組的長度, 并且長度在整個數組生命周期中保持不變; 示例: // 定義一個定長數組…