..
This commit is contained in:
@@ -7,16 +7,20 @@ plugins {
|
||||
|
||||
android {
|
||||
namespace = "com.playwith.playwith_app"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
compileSdk = 34
|
||||
ndkVersion = flutter.ndkVersion
|
||||
|
||||
// [수정할 부분]
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
// 기존 1.8 -> 17로 변경
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
// [수정할 부분]
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_11.toString()
|
||||
// 기존 '1.8' -> '17'로 변경
|
||||
jvmTarget = "17"
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
@@ -24,8 +28,11 @@ android {
|
||||
applicationId = "com.playwith.playwith_app"
|
||||
// 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
|
||||
// [수정] 최소 SDK는 21 이상이면 됨
|
||||
minSdk = flutter.minSdkVersion
|
||||
// [수정] 타겟 SDK도 34로 올림
|
||||
targetSdk = 34
|
||||
|
||||
versionCode = flutter.versionCode
|
||||
versionName = flutter.versionName
|
||||
}
|
||||
|
||||
@@ -1,4 +1,20 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
|
||||
<uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES" />
|
||||
|
||||
<uses-permission android:name="android.permission.CAMERA"/>
|
||||
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.CAMERA"/>
|
||||
|
||||
<application
|
||||
android:label="playwith_app"
|
||||
android:name="${applicationName}"
|
||||
@@ -30,6 +46,12 @@
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.ads.APPLICATION_ID"
|
||||
android:value="ca-app-pub-9504446465764716~3452126047"
|
||||
/>
|
||||
|
||||
</application>
|
||||
<!-- Required to query activities that can process text, see:
|
||||
https://developer.android.com/training/package-visibility and
|
||||
|
||||
@@ -1,5 +1,43 @@
|
||||
package com.playwith.playwith_app
|
||||
|
||||
import android.content.Context
|
||||
import android.net.wifi.WifiManager
|
||||
import android.os.Bundle
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
||||
class MainActivity : FlutterActivity()
|
||||
class MainActivity: FlutterActivity() {
|
||||
// 멀티캐스트 잠금 객체
|
||||
private var multicastLock: WifiManager.MulticastLock? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
acquireMulticastLock()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
releaseMulticastLock()
|
||||
}
|
||||
|
||||
private fun acquireMulticastLock() {
|
||||
try {
|
||||
val wifiManager = applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager
|
||||
// "multicastLock" 태그로 잠금 생성
|
||||
multicastLock = wifiManager.createMulticastLock("multicastLock")
|
||||
multicastLock?.setReferenceCounted(true)
|
||||
multicastLock?.acquire() // 잠금 활성화 (멀티캐스트 수신 허용)
|
||||
println("[Android Native] Multicast Lock Acquired!")
|
||||
} catch (e: Exception) {
|
||||
println("[Android Native] Failed to acquire Multicast Lock: $e")
|
||||
}
|
||||
}
|
||||
|
||||
private fun releaseMulticastLock() {
|
||||
try {
|
||||
multicastLock?.release() // 잠금 해제
|
||||
println("[Android Native] Multicast Lock Released!")
|
||||
} catch (e: Exception) {
|
||||
println("[Android Native] Failed to release Multicast Lock: $e")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,20 +5,20 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
val newBuildDir: Directory =
|
||||
rootProject.layout.buildDirectory
|
||||
.dir("../../build")
|
||||
.get()
|
||||
// [핵심] 빌드 결과물 위치를 Flutter 표준 경로(../../build)로 변경
|
||||
// 이 코드가 없으면 Flutter가 APK를 찾지 못해 에러가 납니다.
|
||||
val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
|
||||
rootProject.layout.buildDirectory.value(newBuildDir)
|
||||
|
||||
subprojects {
|
||||
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
|
||||
project.layout.buildDirectory.value(newSubprojectBuildDir)
|
||||
}
|
||||
|
||||
subprojects {
|
||||
project.evaluationDependsOn(":app")
|
||||
}
|
||||
|
||||
tasks.register<Delete>("clean") {
|
||||
delete(rootProject.layout.buildDirectory)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user