2016-12-12 2 views
0

Ich habe ein Beispielprojekt basierend auf Google Maps in Android Studio erstellt, aber es ist abgestürzt, als ich es ausgeführt habe. Ich benutze mein Smartphone, um es zu testen, weil meine CPU VT-x nicht unterstützt.Warten, bis der Prozess online geht

Dies ist Aktivität:

package com.example.giuseppe.provamaps; 
import android.content.Context; 
import android.support.multidex.MultiDex; 
import android.support.v4.app.FragmentActivity; 
import android.os.Bundle; 
import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.OnMapReadyCallback; 
import com.google.android.gms.maps.SupportMapFragment; 
import com.google.android.gms.maps.model.LatLng; 
import com.google.android.gms.maps.model.MarkerOptions; 
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { 

private GoogleMap mMap; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_maps); 
    // 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 void onMapReady(GoogleMap googleMap) { 
    mMap = googleMap; 

    // Add a marker in Sydney and move the camera 
    LatLng sydney = new LatLng(-34, 151); 
    mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney")); 
    mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)); 
} 

Dies ist das Manifest:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.example.giuseppe.provamaps"> 
<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> 
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme"> 
    <activity 
     android:name=".MapsActivity" 
     android:label="@string/title_activity_maps"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity>   
    <meta-data 
     android:name="com.google.android.geo.API_KEY" 
     android:value="@string/google_maps_key" /> 
</application> 

und dies ist die logcat Ausgabe:

INFO - tools.idea.ddms.adb.AdbService - Initializing adb using: C:\Users\Rosa\AppData\Local\Android\Sdk\platform-tools\adb.exe, client support = true 
INFO - tools.idea.ddms.adb.AdbService - Successfully connected to adb 
INFO - ditor.DeployTargetPickerDialog - Successfully obtained debug bridge 
WARN -     #InstantRun - Instant Run enabled, but not doing an instant run build since: LEGACY_MULTIDEX_REQUIRES_ART 
INFO - a.gradle.invoker.GradleInvoker - About to execute Gradle tasks: [:app:assembleDebug] 
INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:/Program Files/Android/Android Studio/jre 
INFO - a.gradle.invoker.GradleInvoker - Build command line options: [--configure-on-demand, -Pandroid.injected.invoked.from.ide=true, -Pandroid.injected.build.api=19, -Pandroid.injected.build.density=hdpi, -Pandroid.injected.build.abi=armeabi-v7a,armeabi, -Pandroid.injected.coldswap.mode=MULTIDEX, --init-script, C:\Users\Rosa\AppData\Local\Temp\asLocalRepo376.gradle] 
INFO - xecution.GradleExecutionHelper - Passing command-line args to Gradle Tooling API: [--configure-on-demand, -Pandroid.injected.invoked.from.ide=true, -Pandroid.injected.build.api=19, -Pandroid.injected.build.density=hdpi, -Pandroid.injected.build.abi=armeabi-v7a,armeabi, -Pandroid.injected.coldswap.mode=MULTIDEX, --init-script, C:\Users\Rosa\AppData\Local\Temp\asLocalRepo376.gradle] 
INFO - .diagnostic.PerformanceWatcher - High memory usage (free 129 of 1463 MB) while dumping threads to C:\Users\Rosa\.AndroidStudio2.2\system\log\threadDumps-20161211-205128-AI-145.3537739\20161211-213329\threadDump-20161211-213329.txt 
INFO - .diagnostic.PerformanceWatcher - High memory usage (free 125 of 1463 MB) while dumping threads to C:\Users\Rosa\.AndroidStudio2.2\system\log\threadDumps-20161211-205128-AI-145.3537739\20161211-213329\threadDump-20161211-213335.txt 
INFO - pl.ProjectRootManagerComponent - project roots have changed 
INFO - .diagnostic.PerformanceWatcher - Pushing properties took 254ms; general responsiveness: ok; EDT responsiveness: ok 
INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 3027ms; general responsiveness: 0/9 sluggish, 9/9 very slow; EDT responsiveness: 1/3 sluggish, 1/3 very slow 
INFO - indexing.UnindexedFilesUpdater - Unindexed files update started: 7 files to update 
INFO - .diagnostic.PerformanceWatcher - Unindexed files update took 15232ms; general responsiveness: 3/35 sluggish, 26/35 very slow; EDT responsiveness: ok 
INFO - .diagnostic.PerformanceWatcher - High memory usage (free 163 of 1463 MB) while dumping threads to C:\Users\Rosa\.AndroidStudio2.2\system\log\threadDumps-20161211-205128-AI-145.3537739\20161211-213404\threadDump-20161211-213404.txt 
INFO - pl.ProjectRootManagerComponent - project roots have changed 
INFO - a.gradle.run.MakeBeforeRunTask - Gradle invocation complete, success = true 
INFO - .diagnostic.PerformanceWatcher - Pushing properties took 15ms; general responsiveness: ok; EDT responsiveness: ok 
INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 48ms; general responsiveness: ok; EDT responsiveness: ok 
INFO -     #InstantRun - Using legacy/main APK deploy task 
INFO - .diagnostic.PerformanceWatcher - High memory usage (free 135 of 1463 MB) while dumping threads to C:\Users\Rosa\.AndroidStudio2.2\system\log\threadDumps-20161211-205128-AI-145.3537739\20161211-213616\threadDump-20161211-213616.txt 
INFO - .diagnostic.PerformanceWatcher - High memory usage (free 119 of 1463 MB) while dumping threads to C:\Users\Rosa\.AndroidStudio2.2\system\log\threadDumps-20161211-205128-AI-145.3537739\20161211-213616\threadDump-20161211-213622.txt 
INFO - .diagnostic.PerformanceWatcher - High memory usage (free 68 of 1463 MB) while dumping threads to C:\Users\Rosa\.AndroidStudio2.2\system\log\threadDumps-20161211-205128-AI-145.3537739\20161211-213616\threadDump-20161211-213627.txt 
INFO - idea.run.AndroidProcessHandler - Adding device lge-lg_d505-ce1698dd to monitor for launched app: com.example.giuseppe.provamaps 
INFO -   #com.android.ddmlib - Opening a debugger listener at port 8600 for client with pid 21186 
WARN -   #com.android.ddmlib - IO Error while obtaining allocation status 
WARN -   #com.android.ddmlib - Adb rejected connection to client '21199': closed 
WARN -   #com.android.ddmlib - Adb rejected connection to client '21214': closed 
INFO -   #com.android.ddmlib - Opening a debugger listener at port 8602 for client with pid 21298 
INFO -   #com.android.ddmlib - Opening a debugger listener at port 8602 for client with pid 21312 
INFO -   #com.android.ddmlib - Opening a debugger listener at port 8602 for client with pid 21325 

Ich versuchte adb zu verwenden kill-server, a db-Server starten, ungültig chache/Neustart, verwenden Sie ein anderes Gerät, aber nichts funktioniert

Auch in adb logcat es eine Schleife ist (während die App beendet wird):

D/WifiStateMachine: handleMessage: X 
D/BubblePopupHelper: isShowingBubblePopup : false 
D/BubblePopupHelper: isShowingBubblePopup : false 
D/WifiStateMachine: handleMessage: E msg.what=131155 
D/WifiStateMachine: processMsg: ConnectedState 
D/WifiStateMachine: processMsg: L2ConnectedState 
D/WifiNative-wlan0: doString: SIGNAL_POLL 
D/wpa_supplicant: RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c 
D/wpa_supplicant: wlan0: Control interface command 'SIGNAL_POLL' 
D/wpa_supplicant: nl80211: survey data missing! 

Sorry für mein Englisch, ich hoffe jemand kann mir helfen. Vielen Dank an alle

build.gradle:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.1" 
    defaultConfig { 
    applicationId "com.example.giuseppe.provamaps" 
    minSdkVersion 19 
    targetSdkVersion 25 
    multiDexEnabled true 
    versionCode 1 
    versionName "1.0" 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
    } 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
    exclude group: 'com.android.support', module: 'support-annotations' 
}) 
    compile 'com.android.support:appcompat-v7:25.0.1' 
    compile 'com.google.android.gms:play-services:10.0.1' 
    testCompile 'junit:junit:4.12' 
} 

andere Sache, wenn ich versuche, ein Hello World Beispiel ohne Google Maps Aktivität zu starten, es funktioniert.

+0

Könnten Sie Ihre 'build.gradle' veröffentlichen? – antonio

Antwort

0

Ändern Sie diese Abhängigkeit (im build.gradle):

compile 'com.google.android.gms:play-services:10.0.1' 

Für diese:

compile 'com.google.android.gms:play-services-maps:10.0.1' 

nur auf den Karten Komponente abhängen, anstatt auf der gesamten Play Services-Bibliothek abhängig.

+0

du bist mein Held !! Ich weiß nicht wirklich, wie ich dir danken soll –

Verwandte Themen