UnityPlayerActivity.java:3: error: package android.app does not exist
UnityPlayerActivity.java:4: error: package android.content does not exist
UnityPlayerActivity.java:5: error: package android.content.res does not exist
UnityPlayerActivity.java:6: error: package android.graphics does not exist
....
UnityPlayerActivity.java:163: error: method does not override or implement a method from a supertype
@Override public boolean onGenericMotionEvent(MotionEvent event) { return mUnityPlayer.onGenericMotionEvent(event); }
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
62 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':unityLibrary:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
Describe the bug
on 'flutter run' in Android Studio
build on Linux
To Reproduce Follow steps on here: https://pub.dev/packages/flutter_unity_widget#steps
Expected behavior Start the app.
Unity (please complete the following information):
Smartphone (please complete the following information):
Additional context flutter version is 3.0.0 and I have followed until "optional manual android setup No6". I have checked my
And read https://github.com/juicycleff/flutter-unity-view-widget/issues/662 . but it doesn't help.
My build.gradle files
def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } }
def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") }
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' }
def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' }
apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android { compileSdkVersion 33 ndkVersion '23.1.7779620'
}
flutter { source '../..' }
dependencies { implementation project(':unityLibrary') implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" }
buildscript { ext.kotlin_version = '1.6.10' repositories { google() jcenter() maven { url "https://chaquo.com/maven" } }
}
allprojects { repositories { flatDir { dirs "${project(':unityLibrary').projectDir}/libs" }
}
rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" project.evaluationDependsOn(':app') }
task clean(type: Delete) { delete rootProject.buildDir }
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')
}
android { ndkPath "/home/ksh/Unity/Hub/Editor/2022.2.0f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK"
}
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("--libil2cpp-static") 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 + "/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" 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"] } } }