Home  >  Article  >  Backend Development  >  Regarding the use of MapActivity class in Android

Regarding the use of MapActivity class in Android

巴扎黑
巴扎黑Original
2016-12-20 16:20:291235browse

I am learning Android recently and want to make a small application of google-map-api, but I don’t know how hard it is...
The first thing is about the reference position of 52b54c00c74670da48c1b38ba99fb2c9, which is not mentioned in the book. As soon as the program runs A has stopped unexpectedly error appeared. I thought there was a problem with the key provided by the api at first, so I applied again, but the problem is still there, so I searched the Internet and found that it should be like this:

Java code

<application android:icon="@drawable/icon" android:label="@string/app_name">  
    <activity android:name=".HelloAndroid"  
              android:label="@string/app_name">  
        <intent-filter>  
            <action android:name="android.intent.action.MAIN" />  
            <category android:name="android.intent.category.LAUNCHER" />  
        </intent-filter>  
    </activity>  
    <uses-library android:name="com.google.android.maps" />  
</application>

Note that the 52b54c00c74670da48c1b38ba99fb2c9 tag can only be added in the f10a234699bec26c5f525eef715ca592 tag. If the location is incorrect, as a third-party library, it will not be loaded correctly.

After changing this, I continued to run, but the error still occurred, and it still stopped unexpectedly. After several experiments, I finally locked the problem on the MapActivity class, because when I inherited the Activity class as usual, everything was normal, and the GPS also It can be simulated, but if it inherits MapActivity, the above error will occur. Suddenly I remembered whether there was a problem with the library during the build process, and then changed the Project build target option of the Android option in the properties from Android1.5 to Google APIs type. At this time, I had to use it as a third-party library according to the book Delete the map.jar library added to the JAVA build path, because after selecting this, the mar.jar library is automatically included in Google APIs.
At this point, if you run it again, you can see the google map that I have been working on for several hours...
Burn incense...


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn