This commit is contained in:
shurongsen 2025-01-08 18:55:32 +08:00
parent 97460aa137
commit da7e1bc599
9 changed files with 76 additions and 9 deletions

View File

@ -31,6 +31,11 @@ android {
versionName = "1.0" versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags += ""
}
}
} }
buildTypes { buildTypes {
@ -61,6 +66,12 @@ android {
buildFeatures { buildFeatures {
viewBinding = true viewBinding = true
} }
externalNativeBuild {
cmake {
path = file("src/main/cpp/CMakeLists.txt")
version = "3.22.1"
}
}
} }
dependencies { dependencies {

View File

@ -47,7 +47,7 @@
tools:targetApi="31"> tools:targetApi="31">
<!--高德的用户Key。--> <!--高德的用户Key。-->
<meta-data <meta-data
android:name="com.amap.api.v2.apikey" android:name="com.amap.api.map3d"
android:value="7b40cb56460efce245899fef0854ebdf" /> android:value="7b40cb56460efce245899fef0854ebdf" />
<service android:name="com.amap.api.location.APSService" /> <service android:name="com.amap.api.location.APSService" />

View File

@ -0,0 +1,38 @@
# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html.
# For more examples on how to use CMake, see https://github.com/android/ndk-samples.
# Sets the minimum CMake version required for this project.
cmake_minimum_required(VERSION 3.22.1)
# Declares the project name. The project name can be accessed via ${ PROJECT_NAME},
# Since this is the top level CMakeLists.txt, the project name is also accessible
# with ${CMAKE_PROJECT_NAME} (both CMake variables are in-sync within the top level
# build script scope).
project("gaodemap")
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
#
# In this top level CMakeLists.txt, ${CMAKE_PROJECT_NAME} is used to define
# the target library name; in the sub-module's CMakeLists.txt, ${PROJECT_NAME}
# is preferred for the same purpose.
#
# In order to load a library into your app from Java/Kotlin, you must call
# System.loadLibrary() and pass the name of the library defined here;
# for GameActivity/NativeActivity derived applications, the same library name must be
# used in the AndroidManifest.xml file.
add_library(${CMAKE_PROJECT_NAME} SHARED
# List C/C++ source files with relative paths to this CMakeLists.txt.
gaodemap.cpp)
# Specifies libraries CMake should link to your target library. You
# can link libraries from various origins, such as libraries defined in this
# build script, prebuilt third-party libraries, or Android system libraries.
target_link_libraries(${CMAKE_PROJECT_NAME}
# List libraries link to the target library
android
log)

View File

@ -0,0 +1,17 @@
// Write C++ code here.
//
// Do not forget to dynamically load the C++ library into your application.
//
// For instance,
//
// In MainActivity.java:
// static {
// System.loadLibrary("gaodemap");
// }
//
// Or, in MainActivity.kt:
// companion object {
// init {
// System.loadLibrary("gaodemap")
// }
// }

View File

@ -4,8 +4,8 @@ import android.os.Handler
import android.os.Looper import android.os.Looper
import android.view.View import android.view.View
import androidx.core.view.isVisible import androidx.core.view.isVisible
import com.amap.api.maps2d.AMap import com.amap.api.maps.AMap
import com.amap.api.maps2d.CameraUpdateFactory import com.amap.api.maps.CameraUpdateFactory
import org.godotengine.godot.Godot import org.godotengine.godot.Godot
import org.godotengine.godot.plugin.GodotPlugin import org.godotengine.godot.plugin.GodotPlugin
import org.godotengine.godot.plugin.SignalInfo import org.godotengine.godot.plugin.SignalInfo

View File

@ -136,9 +136,9 @@ import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.isVisible import androidx.core.view.isVisible
import com.amap.api.location.AMapLocationClient import com.amap.api.location.AMapLocationClient
import com.amap.api.maps2d.AMap import com.amap.api.maps.AMap
import com.amap.api.maps2d.CameraUpdateFactory import com.amap.api.maps.CameraUpdateFactory
import com.amap.api.maps2d.model.MyLocationStyle import com.amap.api.maps.model.MyLocationStyle
import com.coldmint.gaodemap.databinding.ActivityMainBinding import com.coldmint.gaodemap.databinding.ActivityMainBinding
import org.godotengine.godot.Godot import org.godotengine.godot.Godot
import org.godotengine.godot.GodotFragment import org.godotengine.godot.GodotFragment
@ -177,6 +177,7 @@ class MainActivity : AppCompatActivity(), GodotHost {
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
// 调用全屏设置方法 // 调用全屏设置方法
fullScreen() fullScreen()

View File

@ -23,19 +23,19 @@
android:id="@+id/card_view" android:id="@+id/card_view"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:visibility="visible"
app:cardCornerRadius="8dp" app:cardCornerRadius="8dp"
app:cardElevation="0dp" app:cardElevation="0dp"
android:visibility="gone"
app:cardMaxElevation="0dp" app:cardMaxElevation="0dp"
app:layout_constraintBottom_toTopOf="@+id/guideline2" app:layout_constraintBottom_toTopOf="@+id/guideline2"
app:layout_constraintEnd_toStartOf="@+id/guideline4" app:layout_constraintEnd_toStartOf="@+id/guideline4"
app:layout_constraintStart_toStartOf="@+id/guideline3" app:layout_constraintStart_toStartOf="@+id/guideline3"
app:layout_constraintTop_toTopOf="@+id/guideline"> app:layout_constraintTop_toTopOf="@+id/guideline">
<com.amap.api.maps2d.MapView <com.amap.api.maps.MapView
android:id="@+id/mapView" android:id="@+id/mapView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="163dp" /> android:layout_height="match_parent" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>