config gradle unity
This commit is contained in:
parent
75210e29bc
commit
929f2ce729
@ -9,26 +9,28 @@ android {
|
||||
namespace = "com.example.furibase"
|
||||
//compileSdk = flutter.compileSdkVersion
|
||||
compileSdk = 35
|
||||
ndkVersion = "27.0.12077973"
|
||||
//ndkVersion = "27.0.12077973"
|
||||
//ndkVersion = flutter.ndkVersion
|
||||
ndkVersion = "23.1.7779620"
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_11.toString()
|
||||
jvmTarget = JavaVersion.VERSION_17.toString()
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId = "com.example.furibase"
|
||||
applicationId = "com.paj.freekake"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||||
//minSdk = flutter.minSdkVersion
|
||||
//targetSdk = flutter.targetSdkVersion
|
||||
minSdk = 24 // Set to 24 or higher
|
||||
//minSdk = 24 // Set to 24 or higher
|
||||
minSdk = 30
|
||||
targetSdk = 35
|
||||
versionCode = flutter.versionCode
|
||||
versionName = flutter.versionName
|
||||
@ -46,3 +48,8 @@ android {
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":unityLibrary"))
|
||||
implementation(project(":flutter_unity_widget"))
|
||||
}
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
package com.example.furibase
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
import io.flutter.embedding.android.FlutterFragmentActivity;
|
||||
|
||||
class MainActivity : FlutterActivity()
|
||||
//class MainActivity : FlutterActivity()
|
||||
class MainActivity: FlutterFragmentActivity() {
|
||||
}
|
||||
|
||||
@ -1,5 +1,11 @@
|
||||
allprojects {
|
||||
repositories {
|
||||
flatDir {
|
||||
dirs(
|
||||
file("${project(":unityLibrary").projectDir}/libs")
|
||||
)
|
||||
}
|
||||
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
@ -12,6 +18,39 @@ subprojects {
|
||||
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
|
||||
project.layout.buildDirectory.value(newSubprojectBuildDir)
|
||||
}
|
||||
|
||||
subprojects {
|
||||
afterEvaluate {
|
||||
if (project.extensions.findByName("android") != null) {
|
||||
extensions.configure<com.android.build.gradle.BaseExtension>("android") {
|
||||
if (namespace == null) {
|
||||
namespace = project.group.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plugins.hasPlugin("com.android.application") || plugins.hasPlugin("com.android.library")) {
|
||||
if (name == "flutter_unity_widget") {
|
||||
extensions.configure<com.android.build.gradle.BaseExtension>("android") {
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
(this as ExtensionAware).extensions.configure<org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions>("kotlinOptions") {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
|
||||
if (namespace == null) {
|
||||
namespace = project.group.toString()
|
||||
}
|
||||
|
||||
compileSdkVersion(35)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
project.evaluationDependsOn(":app")
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
||||
# org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
||||
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
|
||||
@ -18,8 +18,30 @@ pluginManagement {
|
||||
|
||||
plugins {
|
||||
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
||||
id("com.android.application") version "8.7.0" apply false
|
||||
id("com.android.application") version "8.9.0" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.8.22" apply false
|
||||
}
|
||||
|
||||
include(":app")
|
||||
|
||||
include(":unityLibrary")
|
||||
project(":unityLibrary").projectDir = file("./unityLibrary")
|
||||
|
||||
include(":unityLibrary:xrmanifest.androidlib")
|
||||
// project(":unityLibrary:xrmanifest.androidlib").projectDir = file("unityLibrary/xrmanifest.androidlib")
|
||||
|
||||
// include(":unityLibrary:mobilenotifications.androidlib")
|
||||
// project(":unityLibrary:mobilenotifications.androidlib").projectDir = file("unityLibrary/mobilenotifications.androidlib")
|
||||
|
||||
|
||||
|
||||
include(":unityLibrary")
|
||||
project(":unityLibrary").projectDir = file("./unityLibrary")
|
||||
|
||||
|
||||
include(":unityLibrary")
|
||||
project(":unityLibrary").projectDir = file("./unityLibrary")
|
||||
|
||||
|
||||
include(":unityLibrary")
|
||||
project(":unityLibrary").projectDir = file("./unityLibrary")
|
||||
|
||||
117
android/unityLibrary/build.gradle
Normal file
117
android/unityLibrary/build.gradle
Normal file
@ -0,0 +1,117 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
|
||||
dependencies {
|
||||
implementation(name: 'unity-classes', ext:'jar')
|
||||
implementation(name: 'arcore_client', ext:'aar')
|
||||
implementation(name: 'ARPresto', ext:'aar')
|
||||
implementation(name: 'UnityARCore', ext:'aar')
|
||||
implementation(name: 'unityandroidpermissions', ext:'aar')
|
||||
implementation project('xrmanifest.androidlib')
|
||||
//implementation project('mobilenotifications.androidlib')
|
||||
|
||||
}
|
||||
|
||||
android {
|
||||
namespace "com.unity3d.player"
|
||||
// ndkPath "/Applications/Unity/Hub/Editor/2022.3.60f1/PlaybackEngines/AndroidPlayer/NDK"
|
||||
compileSdkVersion 35
|
||||
buildToolsVersion '34.0.0'
|
||||
ndkVersion "23.1.7779620"
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 30
|
||||
targetSdkVersion 35
|
||||
ndk {
|
||||
abiFilters 'armeabi-v7a', 'arm64-v8a'
|
||||
}
|
||||
versionCode 1
|
||||
versionName '1.0.2'
|
||||
consumerProguardFiles 'proguard-unity.txt'
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
aaptOptions {
|
||||
noCompress = ['.unity3d', '.ress', '.resource', '.obb', '.bundle', '.unityexp']
|
||||
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
doNotStrip '*/armeabi-v7a/*.so'
|
||||
doNotStrip '*/arm64-v8a/*.so'
|
||||
jniLibs {
|
||||
useLegacyPackaging true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def getSdkDir() {
|
||||
Properties local = new Properties()
|
||||
local.load(new FileInputStream("${rootDir}/local.properties"))
|
||||
return local.getProperty('sdk.dir')
|
||||
}
|
||||
|
||||
def BuildIl2Cpp(String workingDir, String configuration, String architecture, String abi, String[] staticLibraries) {
|
||||
def commandLineArgs = []
|
||||
commandLineArgs.add("--compile-cpp")
|
||||
commandLineArgs.add("--platform=Android")
|
||||
commandLineArgs.add("--architecture=" + architecture)
|
||||
commandLineArgs.add("--outputpath=" + workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.so")
|
||||
commandLineArgs.add("--baselib-directory=" + workingDir + "/src/main/jniStaticLibs/" + abi)
|
||||
commandLineArgs.add("--incremental-g-c-time-slice=3")
|
||||
commandLineArgs.add("--dotnetprofile=unityaot-linux")
|
||||
commandLineArgs.add("--enable-debugger")
|
||||
commandLineArgs.add("--profiler-report")
|
||||
commandLineArgs.add("--profiler-output-file=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_conv.traceevents")
|
||||
commandLineArgs.add("--print-command-line")
|
||||
commandLineArgs.add("--data-folder=" + workingDir + "/src/main/Il2CppOutputProject/Source/il2cppOutput/data")
|
||||
commandLineArgs.add("--generatedcppdir=" + workingDir + "/src/main/Il2CppOutputProject/Source/il2cppOutput")
|
||||
commandLineArgs.add("--cachedirectory=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_cache")
|
||||
commandLineArgs.add("--tool-chain-path=" + android.ndkDirectory)
|
||||
staticLibraries.eachWithIndex {fileName, i->
|
||||
commandLineArgs.add("--additional-libraries=" + workingDir + "/src/main/jniStaticLibs/" + abi + "/" + fileName)
|
||||
}
|
||||
def executableExtension = ""
|
||||
if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
|
||||
executableExtension = ".exe"
|
||||
commandLineArgs = commandLineArgs*.replace('\"', '\\\"')
|
||||
}
|
||||
exec {
|
||||
executable workingDir + "/src/main/Il2CppOutputProject/IL2CPP/build/deploy/il2cpp" + executableExtension
|
||||
args commandLineArgs
|
||||
environment "ANDROID_SDK_ROOT", getSdkDir()
|
||||
}
|
||||
delete workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.sym.so"
|
||||
ant.move(file: workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.dbg.so", tofile: workingDir + "/symbols/" + abi + "/libil2cpp.so")
|
||||
}
|
||||
|
||||
android {
|
||||
task BuildIl2CppTask {
|
||||
doLast {
|
||||
BuildIl2Cpp(projectDir.toString().replaceAll('\\\\', '/'), 'Debug', 'armv7', 'armeabi-v7a', [ ] as String[]);
|
||||
BuildIl2Cpp(projectDir.toString().replaceAll('\\\\', '/'), 'Debug', 'arm64', 'arm64-v8a', [ ] as String[]);
|
||||
}
|
||||
}
|
||||
afterEvaluate {
|
||||
if (project(':unityLibrary').tasks.findByName('mergeDebugJniLibFolders'))
|
||||
project(':unityLibrary').mergeDebugJniLibFolders.dependsOn BuildIl2CppTask
|
||||
if (project(':unityLibrary').tasks.findByName('mergeReleaseJniLibFolders'))
|
||||
project(':unityLibrary').mergeReleaseJniLibFolders.dependsOn BuildIl2CppTask
|
||||
}
|
||||
sourceSets {
|
||||
main {
|
||||
jni.srcDirs = ["src/main/Il2CppOutputProject"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
10
pubspec.yaml
10
pubspec.yaml
@ -49,11 +49,11 @@ dependencies:
|
||||
# arcore_flutter_plugin:
|
||||
# git:
|
||||
# url: https://github.com/giandifra/arcore_flutter_plugin.git
|
||||
flutter_unity_widget: ^2022.2.1
|
||||
# flutter_unity_widget:
|
||||
# git:
|
||||
# url: https://github.com/juicycleff/flutter-unity-view-widget.git
|
||||
# ref: flutter_3.24_android_hotfix
|
||||
# flutter_unity_widget: ^2022.2.1
|
||||
flutter_unity_widget:
|
||||
git:
|
||||
url: https://github.com/juicycleff/flutter-unity-view-widget.git
|
||||
ref: flutter_3.24_android_hotfix
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user