2012-05-03 3 views
3

私のAndroidアプリケーションでjcifs-1.3.17.jarライブラリを使用しています。NoClassDefFoundのアンドロイド2.3でjcifsライブラリを使用中に例外が発生しました

次のコードは、アンドロイド1.6シミュレータでうまく動作しますが、2.3と3.0で失敗します。

アプリケーションが起動すると、2.3シミュレータのlogcatで次のような警告が表示されます。

05-03 10:41:43.105: E/dalvikvm(338): Could not find class 'jcifs.smb.NtlmPasswordAuthentication', referenced from method myPackage.getFile 

NtlmPasswordAuthenticationオブジェクトの作成中に例外が発生することがあります。

05-03 10:49:59.765: E/AndroidRuntime(338): java.lang.NoClassDefFoundError: jcifs.smb.NtlmPasswordAuthentication 

誰かが私に行方不明を教えてもらえますか?

My機能が

public boolean getFile(String url) 
    { 
     try 
     { 

      String name="server1";//my windows username 
      String password="password1";//my windows password 

      SmbFile dir=null; 
      url = url.toLowerCase(); 

      if (!url.startsWith("smb://")) 
       url = "smb://" + url; 

      SmbFile file = null; 
      try 
      { 
       NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, name, password); 
       file = new SmbFile(url, auth); 
       SmbFileInputStream in = new SmbFileInputStream(file); 

       File gpxfile = null; 
       File root = Environment.getExternalStorageDirectory(); 
       gpxfile = new File(root, file.getName()); 
       gpxfile.delete(); 
       gpxfile.createNewFile(); 
       FileOutputStream out = new FileOutputStream(gpxfile); 

       long t0 = System.currentTimeMillis(); 

       byte[] b = new byte[8192]; 
       int n, tot = 0; 
       long t1 = t0; 
       while((n = in.read(b)) > 0) { 
        out.write(b, 0, n); 
        tot += n; 
       } 


      } 
      catch (Exception e1) 
      { 

      } 


      return true; 
     } 
     catch (Exception e) 
     { 
      return false; 
     } 
    } 

答えて

3

では、プロジェクト内のフォルダLIBSを追加し、その中のすべてのあなたのjarファイルをコピーします。

は、プロジェクトの

ので、右クリックして次の手順に従ってください - 名前のlibs

でフォルダを作成し、その

right click on the project --> Built Path-->java built path-->add jars select your jar file from your libs folder 

right click (on libs folder) -->import-->File System-->browse to select your jar file and hit finish and run you project. 

で、この手順に従ってください>

+0

ありがとう....それworkd !!! –

+0

それがうまくいくなら、私のansを受け入れてください。 – Akram

関連する問題