Maps Android V2: java.lang.noclassdeffounderror: com.google.android.gms.R$styleable -
as many following error: java.lang.noclassdeffounderror: com.google.android.gms.r$styleable
when trying implement maps android v2.
somehow must missing doing wrong, since it's not working. tried first copy google-play-services.lib lib folder, saw somewhere shouldn't this.
then tried import addon-google_apis-google-8 project, project gives error the import com.google cannot resolved.
i'm following vogella tutorial:
activity:
supportmapfragment fm = (supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.map); map = fm.getmap(); //map = ((mapfragment) getfragmentmanager().findfragmentbyid(r.id.map)).getmap(); marker hamburg = map.addmarker(new markeroptions().position(hamburg) .title("hamburg")); marker kiel = map.addmarker(new markeroptions() .position(kiel) .title("kiel") .snippet("kiel cool") .icon(bitmapdescriptorfactory .fromresource(r.drawable.btn_logo))); // move camera instantly hamburg zoom of 15. map.movecamera(cameraupdatefactory.newlatlngzoom(hamburg, 15)); // zoom in, animating camera. map.animatecamera(cameraupdatefactory.zoomto(10), 2000, null);
manifest:
<uses-sdk android:minsdkversion="8" android:targetsdkversion="17" /> <permission android:name="com.testmap.test.permission.maps_receive" android:protectionlevel="signature" /> <uses-permission android:name="com.testmap.test.permission.maps_receive" /> <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_fine_location"/> <uses-permission android:name="android.permission.access_coarse_location"/> <uses-permission android:name="android.permission.write_settings" /> uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-feature android:glesversion="0x00020000" android:required="true" /> <meta-data android:name="com.google.android.maps.v2.api_key" android:value="a_real_api_key" /> </application>
i retrieved a_real_api_key entering sha1 retrieved installing keytool plugin.. http://keytool.sourceforge.net/update fingerprint;com.testmap.test in google console.
and xml:
<fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.supportmapfragment" />
i have feeling need import google-play-services library, can tell me step step how in eclipse, i've followed many answers, seem wrong every time.
yes, right. need import google_play_services_lib
, add library project.
for this, need to:
download
google play services
android sdk manageradd project "importing existing android code base". go
~/<android_sdk>/extras/google/google_play_services/libproject
, add workspace.once project has been added workspace, right-click on it, go "properties" , "android" tab , mark library.
go application, , right-click go "properties" , go "android" tab , in library pane, click "add library". should show
google_play_services
project. add reference project.- another requirement right-click on project , go "android tools" option, , "add support library...".
this should maps running.
note: have add google play services "existing android code base" project , not jar.
Comments
Post a Comment