0

お客様から、エラーが発生しているとの連絡がありました。彼らが提出したレポートでは、NoClassDefFoundError が継続的に発生しています。私の他の顧客はこの問題を抱えていないようです。Motorola Droid Maxx でアプリを実行しても、この問題は発生しません。お客様は、ルート化された Droid Bionic でアプリを実行しています。バージョン 2.3 ではすべて正常に動作していましたが、バージョン 2.4 に更新すると、この問題が発生しました。また、コンピューターを新しいものに交換し、現在は Windows 8 を実行しており、adt バンドルをインストールしています。>-90を>-85に変更する際に、問題のファイルに加えた唯一の変更。以下はコードです...コードの下にエラーレポートも含めました。これは電話でのみ発生します。

    import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.telephony.PhoneStateListener;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;


public class ConnectivityCheck extends Activity {

    TelephonyManager        Tel;
   MyPhoneStateListener    MyListener;
   boolean isGsm;
   boolean cellAvailable;
int strengthAmplitudeGSM;
int strengthAmplitudeCDMA;


@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);         

    ConnectivityManager connec =  (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);

    if (connec.getNetworkInfo(0) != null)
    {
        cellAvailable = true;
    }

    if (cellAvailable)
    {
    /* Update the listener, and start it */
        MyListener   = new MyPhoneStateListener();
        Tel = ( TelephonyManager )getSystemService(Context.TELEPHONY_SERVICE);
        Tel.listen(MyListener ,PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
    }

 if (connec.getNetworkInfo(1).getState() == NetworkInfo.State.CONNECTED)
     {
        startActivity(new Intent(ConnectivityCheck.this, LicenseCheck.class));
        if (cellAvailable)
        {
        Tel.listen(MyListener, PhoneStateListener.LISTEN_NONE);
        }
        finish();
     }
  else if (cellAvailable)
  {
     if (connec.getNetworkInfo(0).getState() == NetworkInfo.State.CONNECTED && strengthAmplitudeCDMA >= -90)
     {
         startActivity(new Intent(ConnectivityCheck.this, LicenseCheck.class));
        Tel.listen(MyListener, PhoneStateListener.LISTEN_NONE);
        finish();
     }
     else if (connec.getNetworkInfo(0).getState() == NetworkInfo.State.CONNECTED && isGsm && strengthAmplitudeGSM >= 10 && strengthAmplitudeGSM <= 31)
     {
        startActivity(new Intent(ConnectivityCheck.this, LicenseCheck.class));
        Tel.listen(MyListener, PhoneStateListener.LISTEN_NONE); 
        finish();
     }
     else 
    {

        startActivity(new Intent(ConnectivityCheck.this, ProtocolsMMenuActivity.class));
        Tel.listen(MyListener, PhoneStateListener.LISTEN_NONE); 
        finish();
     }
  }
  else
  {
        startActivity(new Intent(ConnectivityCheck.this, ProtocolsMMenuActivity.class));  
        if (cellAvailable)
        {
        Tel.listen(MyListener, PhoneStateListener.LISTEN_NONE);
        }
    finish();
  }

}

/* Called when the application is minimized */
    @Override
   protected void onPause()
    {
      super.onPause();
            if (cellAvailable)
        {
        Tel.listen(MyListener, PhoneStateListener.LISTEN_NONE);
        }
   }

    /* Called when the application resumes */
   @Override
   protected void onResume()
   {
      super.onResume();
        if (cellAvailable)
        {
        Tel.listen(MyListener, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
        }
       }


   /* Start the PhoneState listener */
    private class MyPhoneStateListener extends PhoneStateListener
    {
      /* Get the Signal strength from the provider, each tiome there is an update */
      @Override
      public void onSignalStrengthsChanged(SignalStrength signalStrength)
      {


    isGsm = signalStrength.isGsm();
    strengthAmplitudeGSM = signalStrength.getGsmSignalStrength();
    strengthAmplitudeCDMA = signalStrength.getCdmaDbm();

     super.onSignalStrengthsChanged(signalStrength);
 }
};/* End of private Class */
}

エラーレポートはこちら

    java.lang.NoClassDefFoundError: com.emsprotocols.njalsprotocolspaidac.ConnectivityCheck
at com.emsprotocols.njalsprotocolspaidac.ProtocolsSplashActivity$1.onAnimationEnd        (ProtocolsSplashActivity.java:144)
 at android.view.animation.AnimationSet.getTransformation(AnimationSet.java:411)
 at android.view.animation.Animation.getTransformation(Animation.java:920)
 at android.view.ViewGroup.drawChild(ViewGroup.java:2657)
 at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
 at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
 at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
 at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
 at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
 at android.view.View.draw(View.java:11009)
 at android.widget.FrameLayout.draw(FrameLayout.java:450)
 at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2154)
 at android.view.ViewRootImpl.draw(ViewRootImpl.java:2096)
 at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1679)
 at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2558)
 at android.os.Handler.dispatchMessage(Handler.java:99)
 at android.os.Looper.loop(Looper.java:137)
 at android.app.ActivityThread.main(ActivityThread.java:4722)
 at java.lang.reflect.Method.invokeNative(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:511)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
 at dalvik.system.NativeStart.main(Native Method)
4

1 に答える 1

1

これは、SDKツールのr21バージョンでよくある問題です。プロジェクト設定に移動し、次にJavaビルドパスに移動します。「Androidの依存関係」を展開すると、libsフォルダーからいくつかの.jarの複製があることがわかります。

トップレベルから重複を削除し、Androidの依存関係フォルダーにあるものだけを残します。次に、プロジェクトをクリーンアップしてください。そうすれば、もう一度やり直すことができます。

于 2012-12-03T23:25:51.217 に答える