2016-06-24 2 views
-1

アプリケーションをデバッグモードで実行していて、Androidスタジオから実行している場合、アプリケーションは正常に動作します。しかし、ビルドする際に、その後APKに署名し、次のスタックトレースとの電話でアプリがクラッシュをインストール:IllegalArgumentException:クラスcom.e.piのデフォルトのコンストラクタにアクセスできません

06-24 13:54:59.725 17656-17656/? E/AndroidRuntime: FATAL EXCEPTION: main 
    Process: com.test, PID: 17656 
    java.lang.RuntimeException: Unable to create application com.test.Utilities.TestApplication: java.lang.IllegalArgumentException: Default constructor for class com.e.pi is not accessible. 
     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4715) 
     at android.app.ActivityThread.-wrap1(ActivityThread.java) 
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405) 
     at android.os.Handler.dispatchMessage(Handler.java:102) 
     at android.os.Looper.loop(Looper.java:148) 
     at android.app.ActivityThread.main(ActivityThread.java:5422) 
     at java.lang.reflect.Method.invoke(Native Method) 
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
    Caused by: java.lang.IllegalArgumentException: Default constructor for class com.e.pi is not accessible. 
     at com.e.mo.b(Unknown Source) 
     at com.e.kh.b(Unknown Source) 
     at com.e.kh.J(Unknown Source) 
     at com.e.gr.a(Unknown Source) 
     at com.test.Utilities.TestApplication.onCreate(Unknown Source) 
     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013) 
     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4712) 
     at android.app.ActivityThread.-wrap1(ActivityThread.java)  
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)  
     at android.os.Handler.dispatchMessage(Handler.java:102)  
     at android.os.Looper.loop(Looper.java:148)  
     at android.app.ActivityThread.main(ActivityThread.java:5422)  
     at java.lang.reflect.Method.invoke(Native Method)  
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)  

私はProGuardのを削除し、問題を解決しないことを好むだろう、任意の助けいただければ幸いです!以下は

アプリケーションコードです:

public class TestApplication extends Application { 

    public static final String TAG = "ALL"; 
    private static TestApplication mInstance; 
    private RequestQueue mRequestQueue; 

    public TestApplication() 
    { 
     mInstance = this; 
    } 

    @Override 
    public void onCreate() { 
     super.onCreate(); 
     Fabric.with(this, new Crashlytics()); 

     String server = "eg...."; 
     // Enable Local Datastore. 
     Parse.enableLocalDatastore(this); 
     Parse.initialize(new Parse.Configuration.Builder(this) 
       .applicationId(BuildConfig.PARSE_APP_ID) 
       .clientKey(BuildConfig.PARSE_CLIENT_KEY) 
       .server(server) 
       .build()); 

     // Logging set to help debug issues, remove before releasing your app. 
     OneSignal.setLogLevel(OneSignal.LOG_LEVEL.DEBUG, OneSignal.LOG_LEVEL.WARN); 

     OneSignal.startInit(this) 
       .setNotificationOpenedHandler(new ExampleNotificationOpenedHandler()) 
       .setAutoPromptLocation(true) 
       .init(); 

     CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() 
       .setDefaultFontPath("fonts/Roboto-Regular.ttf") 
       .setFontAttrId(R.attr.fontPath) 
       .build() 
     ); 
    } 

    public static synchronized TestApplication getInstance() 
    { 
     if(mInstance == null) 
     { 
      mInstance = new TestApplication(); 
     } 
     return mInstance; 
    } 

    public RequestQueue getRequestQueue(Context context) 
    { 
     if(mRequestQueue == null) 
     { 
      mRequestQueue = Volley.newRequestQueue(context); 
     } 

     return mRequestQueue; 
    } 

    public <T> void addToRequestQueue(Request<T> request, String tag, Context context) 
    { 
     request.setTag(TextUtils.isEmpty(tag) ? TAG : tag); 
     request.setShouldCache(false); 
     getRequestQueue(context).add(request); 
    } 

    public <T> void addToRequestQueue(Request<T> request, Context context) 
    { 
     request.setTag(TAG); 
     getRequestQueue(context).add(request); 
    } 

    public void cancelPendingRequests(Object tag) 
    { 
     if(mRequestQueue != null) 
     { 
      mRequestQueue.cancelAll(tag); 
     } 
    } 

    @Override 
    protected void attachBaseContext(Context base) { 
     super.attachBaseContext(base); 
     MultiDex.install(this); 
    } 

    private class ExampleNotificationOpenedHandler implements OneSignal.NotificationOpenedHandler { 
     /** 
     * Callback to implement in your app to handle when a notification is opened from the Android status bar or 
     * a new one comes in while the app is running. 
     * This method is located in this Application class as an example, you may have any class you wish implement NotificationOpenedHandler and define this method. 
     * 
     * @param message  The message string the user seen/should see in the Android status bar. 
     * @param additionalData The additionalData key value pair section you entered in on onesignal.com. 
     * @param isActive  Was the app in the foreground when the notification was received. 
     */ 
     @Override 
     public void notificationOpened(String message, JSONObject additionalData, boolean isActive) { 
      String additionalMessage = ""; 

      try { 
       if (additionalData != null) { 
        if (additionalData.has("this")) { 
         additionalMessage = additionalData.getString("this"); 

         if (additionalMessage.toString().trim().equalsIgnoreCase("x")) { 
          Intent newIntent = new Intent("com.test.push");//this has to match your intent filter 
          newIntent.putExtra("FEATURE_PUSH", "x"); 
          newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
          startActivity(newIntent); 
         } 
         else if (additionalMessage.toString().trim().equalsIgnoreCase("y")) { 
          Intent newIntent = new Intent("com.test.push");//this has to match your intent filter 
          newIntent.putExtra("FEATURE_PUSH", "y"); 
          newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
          startActivity(newIntent); 
         } 
        } 
       } 

      } catch (Throwable t) { 
       t.printStackTrace(); 
      } 
     } 
    } 

    public ImageLoader getImageLoader() { 
     return mImageLoader; 
    } 
} 
+0

ソースコードを 'com.boulevard.Utilities.BoulevardApplication'に投稿してください。そこにはあなたの難しさの源があります。 – CommonsWare

+0

@CommonsWareの上にアプリケーションクラスコードを追加しました – Sarang

+0

ええと...あなたはコンストラクタを削除し、あなたのシングルトン 'mInstance = this'を' attachBaseContext() 'に動かすことができます。それが助けにならないと - 私はそれが期待されません - ProGuardツールを使用して、 'com.e.pi'が何であるかを見るためにスタックトレースを難読化する必要があります。 – CommonsWare

答えて

0

あなたはsupport.annotationから@Keepを使用して維持したいクラスやメソッドに注釈を付けることができます。

+0

ありがとうございますが、どのクラスがこの問題を引き起こしているのかわかりません... – Sarang

関連する問題