Domanda

I have a problem with nested fragments: I have a parent fragment which I use to make a tab for action bar and SupportMapFragment to display a map in it, but if I build my project with Maven, I get this error:

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.SupportMapFragment" on path: DexPathList[[zip file "/data/app/com.etaxi.android.driverapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.etaxi.android.driverapp-1, /system/lib]]

I'm using official ActionBar support library, and also I'm using getChildFragmentManager() everywhere in parent fragment to access SupportMapFragment like that:

map = ((SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map)).getMap();

Any suggestions?

È stato utile?

Soluzione 2

So, seems like the problem was with nested fragments, defined in xml. If add them programmatically, using getChildFragmentManager() instead of getFragmentManager(), everything works fine.

Just put some LinearLayout tag instead of Fragment and then put your nested Fragments in it.

Altri suggerimenti

Follow the image Check library files under Order and Export tab... Go to properties of project by right click -> then Java Build Path... Follow the above image...

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top