2016-06-21 16 views
0

私は自分のアプリケーションでANR警告を取得し続けます。これは、他のいくつかのアプリケーションが私のアプリケーションの上に開いたときに、そのアプリケーションが閉じたときに私のアプリケーションからANRが取得されているときに発生します。私は、私のUIスレッドでネットワーク操作やルーピングをしていません。ログトレースも取得できません。以下は私のコードです。一時停止/再開時にAndroidが応答しない

Activityクラス:

public class AuthenticationActivity extends AppCompatActivity{ 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_authentication); 
    setupActionbar(); 
    String auth_page; 

    if(getIntent().getExtras() != null) 
     auth_page = getIntent().getExtras().getString("auth_page"); 
    else 
     auth_page = "login"; 

    if(auth_page != null) { 
     if (auth_page.equals("login")){ 
      getSupportFragmentManager().beginTransaction().replace(R.id.authentication_container, new LoginFragment()).commitAllowingStateLoss(); 
     }else if(auth_page.equals("signup")){ 
      getSupportFragmentManager().beginTransaction().replace(R.id.authentication_container, new RegisterationFragment()).commitAllowingStateLoss(); 

     } 
    } 
} 

/** 
* Function to set the ToolBar as ActionBar 
*/ 
private void setupActionbar() { 
    setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); 
    setTitle(""); 
    if(getSupportActionBar() != null) { 
     getSupportActionBar().setDisplayHomeAsUpEnabled(true); 
     getSupportActionBar().setDisplayShowHomeEnabled(true); 
     getSupportActionBar().setHomeAsUpIndicator(IconUtils.getBackActionBarIcon(AuthenticationActivity.this)); 
    } 

} 


} 

断片クラス:

public class LoginFragment extends Fragment{ 

private EditText edtMobile; 
private EditText edtPassword; 
private TextView txtForgotPassword; 
private Activity mActivity; 
private MenuItem mMemuLogin; 

@Override 
public void onAttach(Context context) { 
    super.onAttach(context); 
    setHasOptionsMenu(true); 
    mActivity = (Activity) context; 
} 

@Nullable 
@Override 
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 
    View page = inflater.inflate(R.layout.fragment_login, container, false); 
    findViews(page); 
    return page; 
} 


//preparing and calling the login service 
private void login() { 
    // Login service call 
} 

//initialize the views 
private void findViews(View page) { 

} 


@Override 
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { 
    super.onCreateOptionsMenu(menu, inflater); 
    mMemuLogin = menu.findItem(R.id.action_authentication_done).setTitle("Ride"); 
} 

@Override 
public boolean onOptionsItemSelected(MenuItem item) { 
    if (item.getItemId() == R.id.action_authentication_done) { 
     login(); 
    } 
    return super.onOptionsItemSelected(item); 
} 

} 

次の依存関係

は、私のアプリケーション

dependencies { 
compile fileTree(include: ['*.jar'], dir: 'libs') 
compile 'net.steamcrafted:materialiconlib:1.0.3' 
compile files('libs/volley.jar') 
compile 'com.drivemode:TypefaceHelper:1.1.0' 
compile 'com.android.support:multidex:1.0.1' 
compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
    transitive = true; 
} 
compile 'com.android.support:appcompat-v7:23.4.0' 
compile 'com.google.android.gms:play-services:9.0.2' 
compile 'com.pubnub:pubnub-android-debug:3.7.10' 
compile 'com.google.code.gson:gson:2.2.4' 
compile 'com.android.support:design:23.4.0' 
compile 'com.android.support:cardview-v7:23.4.0' 
compile 'com.github.bumptech.glide:glide:3.7.0' 
compile 'com.android.support:recyclerview-v7:23.4.0' 
compile 'joda-time:joda-time:2.3' 
compile 'me.dm7.barcodescanner:zbar:1.8.4' 
compile 'com.google.firebase:firebase-messaging:9.0.2' 
compile 'com.facebook.android:facebook-android-sdk:4.13.0' 

} 適用するプラグインで使用されている:「com.google.gms .google-services '

私のアプリケーションでマニフェスト

<!-- [START firebase_service] --> 
    <service 
     android:name=".MyFirebaseMessagingService"> 
     <intent-filter> 
      <action android:name="com.google.firebase.MESSAGING_EVENT"/> 
     </intent-filter> 
    </service> 
    <!-- [END firebase_service] --> 
    <!-- [START firebase_iid_service] --> 
    <service 
     android:name=".MyFirebaseInstanceIDService"> 
     <intent-filter> 
      <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/> 
     </intent-filter> 
    </service> 
    <!-- [END firebase_iid_service] --> 

Applicationクラス

public class MyApplication extends Application { 
/** 
* Global request queue for Volley 
*/ 
private RequestQueue mRequestQueue; 
/** 
* A singleton instance of the application class for easy access in other places 
*/ 
private static MyApplication sInstance; 

public static final String TAG = MyApplication.class.getSimpleName(); 
private Context mContext; 

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

    AnalyticsTrackers.initialize(this); 
    AnalyticsTrackers.getInstance().get(); 
    Fabric.with(this, new Crashlytics()); 
    FacebookSdk.sdkInitialize(getApplicationContext()); 
    AppEventsLogger.activateApp(this); 
    FacebookSdk.setIsDebugEnabled(true); 
    FacebookSdk.addLoggingBehavior(LoggingBehavior.APP_EVENTS); 

    sInstance = this; 
    mContext=this; 
    TypefaceHelper.initialize(this); 
} 

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

@Override 
public void onTerminate() { 
    TypefaceHelper.destroy(); 
    super.onTerminate(); 
} 

/** 
* @return ApplicationController singleton instance 
*/ 
public static synchronized MyApplication getInstance() { 
    return sInstance; 
} 

public RequestQueue getRequestQueue() { 
    // lazy initialize the request queue, the queue instance will be 
    // created when it is accessed for the first time 
    if(mRequestQueue == null) { 
     mRequestQueue = Volley.newRequestQueue(getApplicationContext()); 
    } 
    return mRequestQueue; 
} 

}

を使用の

サービス:

ANR入力がタイムアウトディスパッチPlayストアにログトレースを発見(キー以外のイベントの送信を待っているために...

これをどのように解決できますか?完全なログトレースが必要な場合はお知らせください。

答えて

0

解決策が見つかりました。私はGoogleのサービスの依存関係を再生することです。依存関係に何らかの問題があるようです。'com.google.android.gms:play-services:9.0.2'をコンパイルしてください。これを削除し、適切な依存関係を追加することで問題が解決されました。プレイサービスマップ:9.0.2

com.google.android.gms:遊ぶ - サービス - 場所私の場合は、次の依存

com.google.android.gmsを追加しました: 9.0.2
com.google.android.gms:play-services-analytics:9.0.2

関連する問題