android - java.lang.ClassNotFoundException: com.hamweather.aeris.maps.R$layout using Aeris Weather SDK -
i using hamweather aeris andorid sdk, , trying implement map view component. when follow online tutorials, can not render aerismapview, , error:
java.lang.classnotfoundexception: com.hamweather.aeris.maps.r$layout.
does know coming from/how fix it?
my xml file:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <com.hamweather.aeris.maps.aerismapview android:id="@+id/aerisfragment_map" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" > </com.hamweather.aeris.maps.aerismapview> </linearlayout>
and activity:
import android.app.activity; import android.app.fragmentmanager; import android.app.fragmenttransaction; import android.content.pm.activityinfo; import android.os.bundle; import android.view.window; public class mapviewactivity extends activity{ @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.mapview_activity); fragmentmanager fragmentmanager = getfragmentmanager(); fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction(); mapfragment fragment = new mapfragment(); fragmenttransaction.add(r.id.frame_container, fragment); fragmenttransaction.commit(); } }
finally, fragment:
import android.location.*; import android.os.bundle; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import com.google.android.gms.maps.model.latlng; import com.hamweather.aeris.communication.aeriscallback; import com.hamweather.aeris.communication.endpointtype; import com.hamweather.aeris.location.locationhelper; import com.hamweather.aeris.maps.aerismapview; import com.hamweather.aeris.maps.aerismapview.aerismaptype; import com.hamweather.aeris.maps.mapviewfragment; import com.hamweather.aeris.maps.interfaces.onaerismaplongclicklistener; import com.hamweather.aeris.maps.interfaces.onaerismarkerinfowindowclicklistener; import com.hamweather.aeris.maps.markers.aerismarker; import com.hamweather.aeris.model.aerisresponse; import com.hamweather.aeris.response.earthquakesresponse; import com.hamweather.aeris.response.firesresponse; import com.hamweather.aeris.response.stormcellresponse; import com.hamweather.aeris.response.stormreportsresponse; public class mapfragment extends mapviewfragment implements onaerismaplongclicklistener, aeriscallback, onaerismarkerinfowindowclicklistener{ @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.single_tab_site_weather2, container, false); mapview = (aerismapview) view.findviewbyid(r.id.aerisfragment_map); mapview.init(savedinstancestate, aerismaptype.google); initmap(); sethasoptionsmenu(true); return view; } /** * inits map specific setting */ private void initmap() { mapview.movetolocation(new latlng(34.7, -86.7), 9); mapview.setonaerismaplongclicklistener(this); mapview.setonaeriswindowclicklistener(this); } @override public void onresult(endpointtype endpointtype, aerisresponse aerisresponse) { } @override public void onmaplongclick(double v, double v1) { } @override public void wildfirewindowpressed(firesresponse firesresponse, aerismarker aerismarker) { } @override public void stormcellswindowpressed(stormcellresponse stormcellresponse, aerismarker aerismarker) { } @override public void stormreportswindowpressed(stormreportsresponse stormreportsresponse, aerismarker aerismarker) { } @override public void earthquakewindowpressed(earthquakesresponse earthquakesresponse, aerismarker aerismarker) { } }
also, first q on stack exchange, if failed adhere convention or etiquette, please let me know, , i'll try fix it. thanks.
i managed working. has issue, here steps:
i first switched using jars using gradle dependency. per website, add following build.gradle(the module one)
repositories { mavencentral() } dependencies { compile 'com.google.android.gms:play-services:4.4.52' compile 'com.hamweather:aeris-maps-library:1.0.0@aar' }
also sure add following, in andorid tag, exists in file:
android { ...some other stuff... dexoptions{ predexlibraries = false } }
double check have proper api key permissions google maps. works. far can tell, had using compiled jar, not repo version.
Comments
Post a Comment