Skip to content

Problem with import sun.nio.ch.DirectBuffer #4

@bigtang5

Description

@bigtang5

I make a new project in the newest Android Studio, copy the udp class and wirehair class into it, everything is OK except this line:
import sun.nio.ch.DirectBuffer

problems show:
Unresolved reference: sun
Unresolved reference: DirectBuffer

here is my build gradle:

plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}

android {
compileSdk 32
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
}

defaultConfig {
    applicationId "com.example.testftp1"
    minSdk 26
    targetSdk 32
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
    jvmTarget = '1.8'
}

}

dependencies {

implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation files('libs/ftplet-api-1.2.0.jar')
implementation files('libs/ftpserver-core-1.2.0.jar')
implementation files('libs/log4j-api-2.17.2.jar')
implementation files('libs/log4j-core-2.17.2.jar')
implementation files('libs/mina-core-2.1.6.jar')
implementation files('libs/slf4j-api-1.7.36.jar')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
implementation 'net.java.dev.jna:jna:5.2.0'
implementation 'net.java.dev.jna:jna-platform:5.2.0'
implementation 'io.github.microutils:kotlin-logging:1.6.24'

testImplementation "org.jetbrains.kotlin:kotlin-reflect:1.3.21"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
testImplementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.26'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"

}

how to fix it? thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions