2016-06-14 65 views
0

Java綁定錯誤從一個活動更改爲另一個活動。Java綁定錯誤從一個活動更改爲另一個活動

06-14 21:16:55.984 16245-16245/com.android.bhavin04.ganeshutsavmumbai E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! 
06-14 21:16:55.984 16245-16260/com.android.bhavin04.ganeshutsavmumbai I/art: Background sticky concurrent mark sweep GC freed 0(0B) AllocSpace objects, 0(0B) LOS objects, 0% free, 92MB/92MB, paused 26.442ms total 1.036s 
06-14 21:16:56.019 16245-16245/com.android.bhavin04.ganeshutsavmumbai E/AndroidRuntime: Error reporting crash 
                         android.os.TransactionTooLargeException 
                          at android.os.BinderProxy.transactNative(Native Method) 
                          at android.os.BinderProxy.transact(Binder.java:496) 
                          at android.app.ActivityManagerProxy.handleApplicationCrash(ActivityManagerNative.java:4208) 
                          at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:89) 
                          at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693) 
                          at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690) 
06-14 21:16:56.019 16245-16245/com.android.bhavin04.ganeshutsavmumbai I/Process: Sending signal. PID: 16245 SIG: 9 

主要活動: -

public class MapsActivity extends AppCompatActivity implements OnMapReadyCallback { 

    private GoogleMap mMap; 
    private android.support.v7.widget.Toolbar toolbar; 
    private LatLngBounds Mumbai = new LatLngBounds(
      new LatLng(-44, 113), new LatLng(19.075984, 72.877656)); 


    @Override 
    protected void onCreate(Bundle savedInstanceState) { 


     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_maps); 

     toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar); // Attaching the layout to the toolbar object 
     setSupportActionBar(toolbar); 
     // Setting toolbar as the ActionBar with setSupportActionBar() call 
     Pushbots.sharedInstance().init(this); 
     // Obtain the SupportMapFragment and get notified when the map is ready to be used. 
     SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() 
       .findFragmentById(R.id.map); 
     mapFragment.getMapAsync(this); 


    } 


    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
     getMenuInflater().inflate(R.menu.menu_main, menu); 
     return true; 
    } 

    /** 
    * On menu item selected 
    */ 
    @Override 
    public boolean onOptionsItemSelected(MenuItem item) { 
     // toggle nav drawer on selecting action bar app icon/title 

     if (onOptionsItemSelected(item)) { 
      return true; 
     } 
     // Handle action bar actions click 
     switch (item.getItemId()) { 
      case R.id.action_settings: 
       // Selected settings menu item 
       // launch Settings activity 
       Intent intent1 = new Intent(MapsActivity.this, 
         Settings.class); 
       startActivity(intent1); 
       return true; 
      /* case R.id.action_favorite: 
       // Selected settings menu item 
       // launch Settings activity 
       Intent intent1 = new Intent(MapsActivity.this, 
         Settings.class); 
       startActivity(intent1); 
       return true;*/ 
      default: 
       return super.onOptionsItemSelected(item); 
     } 

    } 

    @Override 
    public void onMapReady(GoogleMap googleMap) { 

     mMap = googleMap; 
     mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(Mumbai.getCenter(), 14)); 

     if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { 

      return; 
     } 
     // mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); 
     mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); 
     mMap.setMyLocationEnabled(true); 
     mMap.setTrafficEnabled(true); 

     LatLng Mumbai = new LatLng(19.075979, 72.879696); 
     mMap.moveCamera(CameraUpdateFactory.newLatLng(Mumbai)); 


     // Add a marker in Sydney and move the camera 
     LatLng lic = new LatLng(19.180140, 72.947569); 
     mMap.moveCamera(CameraUpdateFactory.newLatLng(lic)); 
     mMap.addMarker(new MarkerOptions().position(lic).title("Lic colony ganeh utsav")); 


     // LOCATION POP UP 
// Get Location Manager and check for GPS & Network location services 
     LocationManager lm = (LocationManager) getSystemService(LOCATION_SERVICE); 
     if (lm.isProviderEnabled(LocationManager.GPS_PROVIDER) || 
       !lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { 
      // Build the alert dialog 
      AlertDialog.Builder builder = new AlertDialog.Builder(this); 
      builder.setTitle("Please Check Location Services is Active"); 
      builder.setMessage("Please enable Location Services and GPS"); 
      builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { 
       public void onClick(DialogInterface dialogInterface, int i) { 
        // Show location settings when the user acknowledges the alert dialog 
        Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); 
        startActivity(intent); 
       } 
      }); 
      Dialog alertDialog = builder.create(); 
      alertDialog.setCanceledOnTouchOutside(false); 
      alertDialog.show(); 
     } 


    } 


} 

我的清單: -

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.android.bhavin04.ganeshutsavmumbai"> 

    <!-- 
     Pushbot permission start 
    --> 

    <!-- GCM connects to Google Services. --> 
    <uses-permission android:name="android.permission.INTERNET" /> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
    <!-- GCM requires a Google account. --> 
    <uses-permission android:name="android.permission.GET_ACCOUNTS" /> 
    <uses-permission android:name="android.permission.WAKE_LOCK" /> 

    <permission 
     android:name="com.android.bhavin04.ganeshutsavmumbai.permission.C2D_MESSAGE" 
     android:protectionLevel="signature" /> 
    <uses-permission android:name="com.android.bhavin04.ganeshutsavmumbai.permission.C2D_MESSAGE" /> 
    <!-- This app has permission to register and receive dataf message. --> 
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> 

    <!-- 
     Pushbot permission end 
    --> 
    <uses-permission android:name="android.permission.INTERNET" /> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 

    <application 

     android:allowBackup="true" 
     android:icon="@drawable/app_ic" 
     android:label="@string/app_name" 
     android:supportsRtl="true" 
     android:theme="@style/Theme.AppCompat.Light.NoActionBar"> 

     <meta-data 
      android:name="com.google.android.geo.API_KEY" 
      android:value="@string/google_maps_key" /> 

     <activity 
      android:name="com.android.bhavin04.ganeshutsavmumbai.Settings" 
      android:label="@string/app_name" /> 
     <activity 

      android:name=".SplashScreen" 
      android:label="@string/app_name"> 


      <intent-filter> 
       <action android:name="com.android.bhavin04.ganeshutsavmumbai.MESSAGE" /> 
       <category android:name="android.intent.category.DEFAULT" /> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 

      </intent-filter> 

     </activity> 
     <!-- 
Pushbot permission start 
--> 
     <activity 
      android:name="com.android.bhavin04.ganeshutsavmumbai.MapsActivity" 
      android:label="@string/app_name" 
      android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 

     <receiver 
      android:name="com.pushbots.google.gcm.GCMBroadcastReceiver" 
      android:permission="com.google.android.c2dm.permission.SEND"> 
      <intent-filter> 
       <!-- Receives the actual messages. --> 
       <action android:name="com.google.android.c2dm.intent.RECEIVE" /> 
       <!-- Receives the registration id. --> 
       <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> 
       <category android:name="com.android.bhavin04.ganeshutsavmumbai" /> 
      </intent-filter> 
     </receiver> 
     <receiver android:name="com.pushbots.push.DefaultPushHandler" /> 

     <service android:name="com.pushbots.push.GCMIntentService" /> 
     <!-- 
Pushbot permission end 
--> 

    </application> 

</manifest> 

構建搖籃: -

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 


    defaultConfig { 
     applicationId "com.android.bhavin04.ganeshutsavmumbai" 
     minSdkVersion 21 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile 'com.pushbots:pushbots-lib:[email protected]' 

    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.4.0' 
    compile 'com.google.android.gms:play-services:9.0.2' 
} 

一個幫助將不勝感激。在切換活動時,我的應用程序突然關閉。我如果你只是使用Google maps服務使用谷歌地圖API

+0

你可以請發表您的build.gradle –

+0

嗯,**失敗粘結劑交易的原因**一般如果您通過將大型元素從一個活動轉移到另一個活動來超出活頁夾事務緩衝區。 –

+0

@BOUTERBIAT Oualid檢查我的gradle構建:) –

回答

0

試圖改變compile 'com.google.android.gms:play-services:9.0.2'compile 'com.google.android.gms:play-services-maps:9.0.2'

+0

更改依賴關係會提高我的效率? –