Closed vdtarsariya closed 5 months ago
This is a Mac OS security policy that can affect any program downloaded from the web. Apparently this triggered on your mac on part of the Unity export.
The next time you trigger this, go to System Preferences -> Security & Privacy
.
You should see the lib where this screenshot shows Example-App.
Click open Anyway, and try your build again.
apply plugin: 'com.android.library'
dependencies { implementation fileTree(dir: 'libs', include: ['*.jar'])
}
android { ndkPath "/Applications/Unity/Hub/Editor/2022.3.18f1/PlaybackEngines/AndroidPlayer/NDK" compileSdkVersion 34 buildToolsVersion '34.0.0'
}
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("--configuration=" + configuration) commandLineArgs.add("--dotnetprofile=unityaot-linux") commandLineArgs.add("--profiler-report") commandLineArgs.add("--profiler-output-file=" + workingDir + "/build/il2cpp"+ abi + "" + configuration + "/il2cppconv.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" 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('\\', '/'), 'Release', '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"] } } }