如何让netbeans找到我的类路径库



我在fedora上安装了netbeans 12.4和java 11。我已经创建了一个Gradle多项目。它编译得很好,但代码完成不工作

在Netbeans中,在tools>libraries中创建了一个名为Facebook的库。然后我从Gradle缓存文件.aar包中提取classes.jar。我重命名并添加这些到Facebook库类路径

当我做

时,我似乎无法在java文件中找到类路径
import com.facebook.*;

Netbeans说找不到类路径com.facebook.*;我在做什么?我怎么能让netbeans识别我的jar时,我像代码完成编码

项目build.gradle

description = 'Example Project'
buildscript {
repositories {
google()
mavenCentral()
}

dependencies {
classpath("com.android.tools.build:gradle:4.2.0")
}
}
allprojects {
group = 'com.example'
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
项目settings.gradle

rootProject.name = 'example'
include ':app'
模块build.gradle

plugins {
id 'com.android.application'
}
description = 'app'
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId("com.example.app")
minSdkVersion 23
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation":"$projectDir/schemas".toString()]
}
}
}
buildTypes {

debug {
minifyEnabled false
}

release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
annotationProcessor 'androidx.room:room-compiler:2.3.0'
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.core:core:1.6.0'
implementation 'androidx.fragment:fragment:1.3.6'
implementation 'androidx.lifecycle:lifecycle-livedata:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.3.1'
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
implementation 'androidx.room:room-runtime:2.3.0'
implementation 'com.facebook.android:facebook-android-sdk:5.15.3'
implementation 'com.google.android.material:material:1.4.0'
testImplementation 'androidx.room:room-testing:2.3.0'
testImplementation 'junit:junit:4.13.2'
}

在Projects窗口中右键单击缺少库的项目名称->属性→

项目属性弹出。在"类别"树中选择"库"。节点→

在Project Properties窗口的右侧,按"Add JAR/Folder"→

在这里选择你需要的jar。

你也可以看我的短视频How-To。

最新更新