gpt4 book ai didi

java - 致命异常 : main java. lang.NoClassDefFoundError : org. apache.commons.net.ftp.FTPClient Android Studio

转载 作者:行者123 更新时间:2023-11-29 21:29:37 26 4
gpt4 key购买 nike

我知道这个问题有一些回复:

one

two

three

我正在使用 Android Studio:

所以我在 libs 文件夹中有这个库: Project libs

module libs

我修改了build.gradle:

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'

repositories {
mavenCentral()
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"

defaultConfig {
minSdkVersion 11
targetSdkVersion 18
}
}

dependencies {
compile 'com.android.support:appcompat-v7:18.0.0'
compile 'com.google.android.gms:play-services:3.1.36'
compile files ('libs/commons-net-3.3.jar')
}

此 Activity 使用我的 ftp:

...
import org.apache.commons.net.ftp.*;

public class GalleryActivity extends Activity {

private TextView debugText;
private FTPClient ftpClient;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gellery);
// Show the Up button in the action bar.
setupActionBar();
debugText = (TextView) findViewById(R.id.debug_text);
try {

ftpClient = new FTPClient();
ftpClient.connect("ftp.strefa.pl");
Toast toast = Toast.makeText(getApplicationContext(),
"polaczono",Toast.LENGTH_SHORT);
toast.show();
ftpClient.login("admin+ftpforproject.strefa.pl","studia12");
toast = Toast.makeText(getApplicationContext(),
"zalogowano",Toast.LENGTH_SHORT);
toast.show();
ftpClient.enterLocalPassiveMode();
FTPFile[] fileList = ftpClient.listFiles();

String fileNames = "";

for(FTPFile file : fileList){
fileNames+= file.getName() +"\n";
}
debugText.setText(fileNames);

}catch (Exception e) {
e.printStackTrace();
}



}
...

我知道出了点问题,因为我在外部库中没有它:

external library

我已经添加了谷歌服务库并且它可以工作,我的 map 正在渲染,但在图库中我没有这个运气。

我做错了什么?我很沮丧,请帮忙!

最佳答案

一段时间后,我重新启动了 IDE 并重建了一个项目(清理并构建),问题解决了。我不知道该说什么,愚蠢的 Android Studio:/

关于java - 致命异常 : main java. lang.NoClassDefFoundError : org. apache.commons.net.ftp.FTPClient Android Studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19775126/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com