我正在搜索将Android设备变成FTP服务器的库。 Java FTP客户端似乎有无数的库,但是我看到了一个问题here.
所以我在这里遵循这个教程:
然而,运行我的应用程序会给我一个NoClassDefFoundError
MainActivity.java
<ul>
@foreach($users as $user)
<li>
<span>{{$user->count}}:</span>
@foreach($user->names as $index=>$name)
<span><a href="#">{{$name}}</a> @if($index!=count($user->names)-1) ,@endif </span>
@endforeach
</li>
@endforeach
</ul>
的build.gradle
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FtpServerFactory serverFactory = new FtpServerFactory();
FtpServer server = serverFactory.createServer();
// start the server
try {
server.start();
} catch (FtpException e) {
e.printStackTrace();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
logcat的:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.ken.androidftpserver"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
那里有libs吗?
答案 0 :(得分:0)
问题是我使用的是不同版本的slf4j-simple和slf4j。他们需要是一样的。