Creating on an imagebutton that openes a new activity onclick crushes - android-activity

I tried to do this:
when I click on the imagebutton then it opened new activity (named : TakingPick.class).
It crashed and I don't understand the logcat.
what do I need to do to make it work?
public class MainActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void sendMessage(View view) {
Intent intent = new Intent(this, TakingPick.class);
startActivity(intent);
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
return false;
}
}
xml: activity_main
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="#drawable/bridgebg"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="#drawable/bridgenew" />
<ImageButton
android:id="#+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:onClick="sendMessage"
android:layout_marginBottom="61dp"
android:src="#drawable/loginfacebook" />
The LOGCAT:
06-14 19:36:56.111: E/dalvikvm-heap(14770): Out of memory on a 354168112-byte allocation.
06-14 19:36:56.211: E/AndroidRuntime(14770): FATAL EXCEPTION: main
06-14 19:36:56.211: E/AndroidRuntime(14770): Process: idan.nir.debridge, PID: 14770
06-14 19:36:56.211: E/AndroidRuntime(14770): java.lang.OutOfMemoryError
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:677)
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:507)
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:872)
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.content.res.Resources.loadDrawable(Resources.java:3056)
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.content.res.Resources.getDrawable(Resources.java:1613)
06-14 19:36:56.211: E/AndroidRuntime(14770): at com.android.internal.widget.ActionBarView.setIcon(ActionBarView.java:1016)
06-14 19:36:56.211: E/AndroidRuntime(14770): at com.android.internal.policy.impl.PhoneWindow.setDefaultIcon(PhoneWindow.java:1543)
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.app.Activity.initActionBar(Activity.java:2001)
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.app.Activity.setContentView(Activity.java:2016)
06-14 19:36:56.211: E/AndroidRuntime(14770): at idan.nir.debridge.TakingPick.onCreate(TakingPick.java:14)
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.app.Activity.performCreate(Activity.java:5431)
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.app.ActivityThread.access$900(ActivityThread.java:161)
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.os.Handler.dispatchMessage(Handler.java:102)
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.os.Looper.loop(Looper.java:157)
06-14 19:36:56.211: E/AndroidRuntime(14770): at android.app.ActivityThread.main(ActivityThread.java:5356)
06-14 19:36:56.211: E/AndroidRuntime(14770): at java.lang.reflect.Method.invokeNative(Native Method)
06-14 19:36:56.211: E/AndroidRuntime(14770): at java.lang.reflect.Method.invoke(Method.java:515)
06-14 19:36:56.211: E/AndroidRuntime(14770): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
06-14 19:36:56.211: E/AndroidRuntime(14770): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
06-14 19:36:56.211: E/AndroidRuntime(14770): at dalvik.system.NativeStart.main(Native Method)
TakingPick
public class TakingPick extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO Auto-generated method stub
setContentView(R.layout.takingpick);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
return false;
}
}
xml:takingPick
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="#drawable/bridgebg"
android:layout_height="match_parent" >
</RelativeLayout>

You got an out of memory exception. One of the bitmaps you are trying to load is to big and causing a memory leak.
If you are using a drawable resource, make sure it's in the correct drawable directory. Also try to reduce the image size and resolution

Related

ClassifierCompositeItemWriter with JDBC and XML Writer

I have an task to read the XML file, process the same and write the records either in database or xml file based on the condition.
I used the ClassifierCompositeItemWriter to classify my records and calling the writers accordingly.
<bean id="jdbcClassifierItemWriter" class="org.springframework.batch.item.support.ClassifierCompositeItemWriter">
<property name="classifier">
<bean class="org.springframework.classify.BackToBackPatternClassifier">
<property name="routerDelegate">
<bean class="com.test.MyClassifier"></bean>
</property>
<property name="matcherMap">
<map>
<entry key="XML" value-ref="XmlItemWriter" />
<entry key="DB_INSERT" value-ref="insert_writer" />
<entry key="DB_UPDATE" value-ref="update_writer" />
</map>
</property>
</bean>
</property>
<bean id="XmlItemWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter" scope="step">
<property name="resource" value="file:#{jobParameters[location]}" />
<property name="rootTagName" value="USER" />
<property name="marshaller" ref="userUnmarshaller" />
</bean>
<bean id="userUnmarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="classesToBeBound">
<list>
<value>com.test.User</value>
</list>
</property>
</bean>
I am able to update and insert records in database successfully. But while writing XML I am getting below error. I tried each and every combination but still not luck. If you encountered this error earlier, any help is appreciated.
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.batch.item.xml.StaxUtils.getResult(StaxUtils.java:116)
at org.springframework.batch.item.xml.StaxEventItemWriter.createStaxResult(StaxEventItemWriter.java:532)
at org.springframework.batch.item.xml.StaxEventItemWriter.write(StaxEventItemWriter.java:739)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy58.write(Unknown Source)
at org.springframework.batch.item.support.ClassifierCompositeItemWriter.write(ClassifierCompositeItemWriter.java:66)
at org.springframework.batch.item.support.CompositeItemWriter.write(CompositeItemWriter.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy55.write(Unknown Source)
at org.springframework.batch.core.step.item.SimpleChunkProcessor.writeItems(SimpleChunkProcessor.java:175)
at org.springframework.batch.core.step.item.SimpleChunkProcessor.doWrite(SimpleChunkProcessor.java:151)
at org.springframework.batch.core.step.item.SimpleChunkProcessor.write(SimpleChunkProcessor.java:274)
at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:199)
at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:75)
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406)
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271)
at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81)
at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:374)
at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)
at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144)
at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:257)
at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:200)
at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148)
at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64)
at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:67)
at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:169)
at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:144)
at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:134)
at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:306)
at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:135)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:128)
at com.test.BaseBatchController.executeBatch(BaseBatchController.java:97)
at com.test.WebController.executeBatch(WebController.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:177)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1526)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1482)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: StAXResult(XMLEventWriter) with XMLEventWriter == null
at javax.xml.transform.stax.StAXResult.<init>(StAXResult.java:90)
at org.springframework.util.xml.StaxUtils.createStaxResult(StaxUtils.java:145)
... 95 more
I am still curious to know how to solve this issue, but for workaround I created the Simple Custom writer which will write the records in file, it is working fine.
public class SimpleXMLWriter implements ItemWriter<User> {
private UserList userList = new UserList();
#Override
public void write(List<? extends User> items) throws Exception {
try{
this.userList.getUserList().add(items.get(0));
marshalObject();
}catch(Exception e){
LOGGER.error("Error in writer "+e);
}
}
private void marshalObject() throws JAXBException, IOException {
JAXBContext jaxbContext = JAXBContext.newInstance(UserList.class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
// Marshal the user list in console
//jaxbMarshaller.marshal(userList, System.out);
// Marshal the user list in file
jaxbMarshaller.marshal(userList, new FileWriter(resource.getFile().getAbsolutePath()));
}
public Resource getResource() {
return resource;
}
public void setResource(Resource resource) {
this.resource = resource;
}
}
Got the same problem. I solved it declaring the XmlItemWriter as stream of the chunk, like this:
<chunk reader="myItemReader" processor="myItemProcessor"
writer="myClassifierCompositeWriter">
<streams>
<stream ref="myXmlItemWriter" />
</streams>
</chunk>

NavigationDrawer unable to instatiate application java.lang.classnotfoundexception

I`m developing an app. And at this part I only have an activity for my Navigation Drawer.
Im trying to run but I get the same Exception everytime.. Ive searched for some time, tried a lot of things but nothing worked.
Here`s my logcat:
02-23 17:45:09.379: E/AndroidRuntime(3364): FATAL EXCEPTION: main
02-23 17:45:09.379: E/AndroidRuntime(3364): Process: com.example.testedrawer, PID: 3364
02-23 17:45:09.379: E/AndroidRuntime(3364): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.testedrawer/com.example.testedrawer.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.testedrawer.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.testedrawer-2/base.apk"],nativeLibraryDirectories= [/vendor/lib, /system/lib]]
02-23 17:45:09.379: E/AndroidRuntime(3364): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
02-23 17:45:09.379: E/AndroidRuntime(3364): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
02-23 17:45:09.379: E/AndroidRuntime(3364): at android.app.ActivityThread.access$800(ActivityThread.java:144)
02-23 17:45:09.379: E/AndroidRuntime(3364): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
02-23 17:45:09.379: E/AndroidRuntime(3364): at android.os.Handler.dispatchMessage(Handler.java:102)
02-23 17:45:09.379: E/AndroidRuntime(3364): at android.os.Looper.loop(Looper.java:135)
02-23 17:45:09.379: E/AndroidRuntime(3364): at android.app.ActivityThread.main(ActivityThread.java:5221)
02-23 17:45:09.379: E/AndroidRuntime(3364): at java.lang.reflect.Method.invoke(Native Method)
02-23 17:45:09.379: E/AndroidRuntime(3364): at java.lang.reflect.Method.invoke(Method.java:372)
02-23 17:45:09.379: E/AndroidRuntime(3364): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
02-23 17:45:09.379: E/AndroidRuntime(3364): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
02-23 17:45:09.379: E/AndroidRuntime(3364): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.testedrawer.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.testedrawer-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
02-23 17:45:09.379: E/AndroidRuntime(3364): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
02-23 17:45:09.379: E/AndroidRuntime(3364): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
My Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.testedrawer"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Please help me..
Ive already fixed it. Ive tried so many things that didn't work on Eclipse. Than I tried to do it on Android Studio.. And it worked! Thanks for your help, though!

Primefaces Tag Cloud throwing a null pointer exception

I am trying to add the tag cloud component to my jsf page but it's throwing a null pointer exception.
Before adding this component , the page render normally.I used the exact code of the showcase and i added the managedBean to my faces-config.
I am using eclipse kepler, glassfish 4 and primefaces 4
Here is a snippet of my code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html">
<h:head>
<meta></meta>
<link rel="stylesheet" type="text/css" href="css/styles.css" />
</h:head>
<h:body>
<p:tagCloud model="#{tagCloudBean.model}">
<p:ajax event="select" update="msg" listener="#{tagCloudBean.onSelect}" />
</p:tagCloud>
<p:inputText size="56"></p:inputText>
<h:panelGrid columns="2" style="margin-top:10px">
<p:commandButton id="submitButton" value="Submit"
icon="ui-icon-disk" />
<p:commandButton id="clearButton" type="button" value="Clear"
onclick="PF('editor').clear()" icon="ui-icon-close" />
</h:panelGrid>
And this the log
2013-11-22T16:11:03.284+0100|Grave: Error Rendering View[/forum.xhtml]
java.lang.NullPointerException
at org.primefaces.component.tagcloud.TagCloudRenderer.encodeMarkup(TagCloudRenderer.java:59)
at org.primefaces.component.tagcloud.TagCloudRenderer.encodeEnd(TagCloudRenderer.java:38)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:894)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304)
at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)
at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:894)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:70)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:57)
at org.primefaces.component.panel.PanelRenderer.encodeContent(PanelRenderer.java:204)
at org.primefaces.component.panel.PanelRenderer.encodeMarkup(PanelRenderer.java:121)
at org.primefaces.component.panel.PanelRenderer.encodeEnd(PanelRenderer.java:58)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at org.primefaces.component.tabview.TabViewRenderer.encodeTabContent(TabViewRenderer.java:304)
at org.primefaces.component.tabview.TabViewRenderer.encodeContents(TabViewRenderer.java:262)
at org.primefaces.component.tabview.TabViewRenderer.encodeMarkup(TabViewRenderer.java:133)
at org.primefaces.component.tabview.TabViewRenderer.encodeEnd(TabViewRenderer.java:72)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:724)
2013-11-22T16:11:03.291+0100|Avertissement: StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
java.lang.NullPointerException
at org.primefaces.component.tagcloud.TagCloudRenderer.encodeMarkup(TagCloudRenderer.java:59)
at org.primefaces.component.tagcloud.TagCloudRenderer.encodeEnd(TagCloudRenderer.java:38)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:894)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304)
at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)
at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:894)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:70)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:57)
at org.primefaces.component.panel.PanelRenderer.encodeContent(PanelRenderer.java:204)
at org.primefaces.component.panel.PanelRenderer.encodeMarkup(PanelRenderer.java:121)
at org.primefaces.component.panel.PanelRenderer.encodeEnd(PanelRenderer.java:58)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at org.primefaces.component.tabview.TabViewRenderer.encodeTabContent(TabViewRenderer.java:304)
at org.primefaces.component.tabview.TabViewRenderer.encodeContents(TabViewRenderer.java:262)
at org.primefaces.component.tabview.TabViewRenderer.encodeMarkup(TabViewRenderer.java:133)
at org.primefaces.component.tabview.TabViewRenderer.encodeEnd(TabViewRenderer.java:72)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:724)
What's the first line?
java.lang.NullPointerException
at org.primefaces.component.tagcloud.TagCloudRenderer.encodeMarkup(TagCloudRenderer.java:59)
Ah okay, let's look at line 59 of the source code of TagCloudRenderer:
59 for(TagCloudItem item : model.getTags()) {
Well, looks like either model as defined by <p:tagCloud model="#{tagCloudBean.model}"> is null or its getTags() method returned null.
Logically, this can in turn have the following causes:
#{tagCloudBean} doesn't exist and is thus null.
#{tagCloudBean.model} returned null.
#{tagCloudBean.model.tags} returned null.
As you indicated to have copypasted the showcase example, which contains the right model, but lacks the bean management annotations, I gather that it's caused by #1.
Adding it to faces-config.xml is unnecessary and you most likely did it wrong, e.g. using a managed bean name of TagCloudBean instead of tagCloudBean. Making it a managed bean the usual JSF 2.x way as follows should fix the issue of #{tagCloudBean} being null. It namely defaults to the right managed bean name already.
#ManagedBean
#RequestScoped
public class TagCloudBean {}

HoloEverywhere AutoCompleteTextView java.lang.ClassCastException

I am trying to get the HoloEverywhere class AutoCompleteTextView to work with my app. The main reason for this is I want the Holo theme to work on pre 3.0 devices (specifically API levels 8-10) Here is my main activity code:
package com.example.testautocomp;
import org.holoeverywhere.widget.AutoCompleteTextView;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
public class MainActivity extends Activity {
private AutoCompleteTextView m_edit;
private static final String[] items = { "lorem", "ipsum", "dolor", "sit",
"amet", "consectetuer", "adipiscing", "elit", "morbi", "vel",
"augue", "purus", "sitter", "sitting", "sither", "sithar" };
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
m_edit = (AutoCompleteTextView)findViewById(R.id.edit2);
m_edit.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, items));
}
}
also my activity_main.xml code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<AutoCompleteTextView
android:id="#+id/edit2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
android:hint="Testing" />
</LinearLayout>
When I run my app, it goes into the debugger for eclipse and after pressing resume (or F8) to continue the thread, my app crashes/force closes and I get the following error in my LogCat:
04-19 17:52:56.342: W/dalvikvm(675): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
04-19 17:52:56.422: E/AndroidRuntime(675): FATAL EXCEPTION: main
04-19 17:52:56.422: E/AndroidRuntime(675): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.testautocomp/com.example.testautocomp.MainActivity}: java.lang.ClassCastException: android.widget.AutoCompleteTextView cannot be cast to org.holoeverywhere.widget.AutoCompleteTextView
04-19 17:52:56.422: E/AndroidRuntime(675): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
04-19 17:52:56.422: E/AndroidRuntime(675): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
04-19 17:52:56.422: E/AndroidRuntime(675): at android.app.ActivityThread.access$600(ActivityThread.java:123)
04-19 17:52:56.422: E/AndroidRuntime(675): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
04-19 17:52:56.422: E/AndroidRuntime(675): at android.os.Handler.dispatchMessage(Handler.java:99)
04-19 17:52:56.422: E/AndroidRuntime(675): at android.os.Looper.loop(Looper.java:137)
04-19 17:52:56.422: E/AndroidRuntime(675): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-19 17:52:56.422: E/AndroidRuntime(675): at java.lang.reflect.Method.invokeNative(Native Method)
04-19 17:52:56.422: E/AndroidRuntime(675): at java.lang.reflect.Method.invoke(Method.java:511)
04-19 17:52:56.422: E/AndroidRuntime(675): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-19 17:52:56.422: E/AndroidRuntime(675): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-19 17:52:56.422: E/AndroidRuntime(675): at dalvik.system.NativeStart.main(Native Method)
04-19 17:52:56.422: E/AndroidRuntime(675): Caused by: java.lang.ClassCastException: android.widget.AutoCompleteTextView cannot be cast to org.holoeverywhere.widget.AutoCompleteTextView
04-19 17:52:56.422: E/AndroidRuntime(675): at com.example.testautocomp.MainActivity.onCreate(MainActivity.java:22)
04-19 17:52:56.422: E/AndroidRuntime(675): at android.app.Activity.performCreate(Activity.java:4465)
04-19 17:52:56.422: E/AndroidRuntime(675): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
04-19 17:52:56.422: E/AndroidRuntime(675): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
04-19 17:52:56.422: E/AndroidRuntime(675): ... 11 more
How do i fix this CastClassException?
No, your action above incorrect. You should change activity base class on org.holoeverywhere.app.Activity.
Very similar to this question
Fixed it by changing my main_activity.xml to:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<org.holoeverywhere.widget.AutoCompleteTextView
android:id="#+id/edit2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
android:hint="Testing" />
</LinearLayout>
the main part being org.holoeverywhere.widget.AutoCompleteTextView

Embedding google maps android v2 in android

i created application in android 2.33 . i used apk v2 keys and i followed all the steps but still its showing error
**xml**
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />
**Mainfest**
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.Maps.mappv2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<permission
android:name="com.Maps.mappv2.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.Maps.mappv2.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<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:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter >
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="mm" />
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyA64MFhpngQBkXP5__fvHeLE0xAXWKwfgU"/>
</application>
</manifest>
**Activity**
public class MainActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
i included google-play-services jar library file but still it showing un expectedly stoped...
**The error are**
12-22 20:51:59.344: E/Trace(698): error opening trace file: No such file or directory (2)
12-22 20:52:00.165: E/AndroidRuntime(698): FATAL EXCEPTION: main
12-22 20:52:00.165: E/AndroidRuntime(698): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
12-22 20:52:00.165: E/AndroidRuntime(698): at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
12-22 20:52:00.165: E/AndroidRuntime(698): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
12-22 20:52:00.165: E/AndroidRuntime(698): at android.app.Activity.onCreateView(Activity.java:4663)
12-22 20:52:00.165: E/AndroidRuntime(698): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
12-22 20:52:00.165: E/AndroidRuntime(698): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
12-22 20:52:00.165: E/AndroidRuntime(698): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
12-22 20:52:00.165: E/AndroidRuntime(698): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
12-22 20:52:00.165: E/AndroidRuntime(698): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
12-22 20:52:00.165: E/AndroidRuntime(698): at android.app.Activity.setContentView(Activity.java:1867)
12-22 20:52:00.165: E/AndroidRuntime(698): at com.Maps.mappv2.MainActivity.onCreate(MainActivity.java:13)
12-22 20:52:00.165: E/AndroidRuntime(698): at android.app.Activity.performCreate(Activity.java:5008)
12-22 20:52:00.165: E/AndroidRuntime(698): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
12-22 20:52:00.165: E/AndroidRuntime(698): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
12-22 20:52:00.165: E/AndroidRuntime(698): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
12-22 20:52:00.165: E/AndroidRuntime(698): at android.app.ActivityThread.access$600(ActivityThread.java:130)
12-22 20:52:00.165: E/AndroidRuntime(698): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
12-22 20:52:00.165: E/AndroidRuntime(698): at android.os.Handler.dispatchMessage(Handler.java:99)
12-22 20:52:00.165: E/AndroidRuntime(698): at android.os.Looper.loop(Looper.java:137)
12-22 20:52:00.165: E/AndroidRuntime(698): at android.app.ActivityThread.main(ActivityThread.java:4745)
12-22 20:52:00.165: E/AndroidRuntime(698): at java.lang.reflect.Method.invokeNative(Native Method)
12-22 20:52:00.165: E/AndroidRuntime(698): at java.lang.reflect.Method.invoke(Method.java:511)
12-22 20:52:00.165: E/AndroidRuntime(698): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
12-22 20:52:00.165: E/AndroidRuntime(698): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-22 20:52:00.165: E/AndroidRuntime(698): at dalvik.system.NativeStart.main(Native Method)
12-22 20:52:39.734: E/Trace(724): error opening trace file: No such file or directory (2)
12-22 20:52:40.244: E/AndroidRuntime(724): FATAL EXCEPTION: main
12-22 20:52:40.244: E/AndroidRuntime(724): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
12-22 20:52:40.244: E/AndroidRuntime(724): at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
12-22 20:52:40.244: E/AndroidRuntime(724): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
12-22 20:52:40.244: E/AndroidRuntime(724): at android.app.Activity.onCreateView(Activity.java:4663)
12-22 20:52:40.244: E/AndroidRuntime(724): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
12-22 20:52:40.244: E/AndroidRuntime(724): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
12-22 20:52:40.244: E/AndroidRuntime(724): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
12-22 20:52:40.244: E/AndroidRuntime(724): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
12-22 20:52:40.244: E/AndroidRuntime(724): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
12-22 20:52:40.244: E/AndroidRuntime(724): at android.app.Activity.setContentView(Activity.java:1867)
12-22 20:52:40.244: E/AndroidRuntime(724): at com.Maps.mappv2.MainActivity.onCreate(MainActivity.java:13)
12-22 20:52:40.244: E/AndroidRuntime(724): at android.app.Activity.performCreate(Activity.java:5008)
12-22 20:52:40.244: E/AndroidRuntime(724): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
12-22 20:52:40.244: E/AndroidRuntime(724): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
12-22 20:52:40.244: E/AndroidRuntime(724): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
12-22 20:52:40.244: E/AndroidRuntime(724): at android.app.ActivityThread.access$600(ActivityThread.java:130)
12-22 20:52:40.244: E/AndroidRuntime(724): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
12-22 20:52:40.244: E/AndroidRuntime(724): at android.os.Handler.dispatchMessage(Handler.java:99)
12-22 20:52:40.244: E/AndroidRuntime(724): at android.os.Looper.loop(Looper.java:137)
12-22 20:52:40.244: E/AndroidRuntime(724): at android.app.ActivityThread.main(ActivityThread.java:4745)
12-22 20:52:40.244: E/AndroidRuntime(724): at java.lang.reflect.Method.invokeNative(Native Method)
12-22 20:52:40.244: E/AndroidRuntime(724): at java.lang.reflect.Method.invoke(Method.java:511)
12-22 20:52:40.244: E/AndroidRuntime(724): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
12-22 20:52:40.244: E/AndroidRuntime(724): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-22 20:52:40.244: E/AndroidRuntime(724): at dalvik.system.NativeStart.main(Native Method)
12-22 20:52:49.084: E/Trace(738): error opening trace file: No such file or directory (2)
12-22 20:52:49.624: E/AndroidRuntime(738): FATAL EXCEPTION: main
12-22 20:52:49.624: E/AndroidRuntime(738): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
12-22 20:52:49.624: E/AndroidRuntime(738): at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
12-22 20:52:49.624: E/AndroidRuntime(738): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
12-22 20:52:49.624: E/AndroidRuntime(738): at android.app.Activity.onCreateView(Activity.java:4663)
12-22 20:52:49.624: E/AndroidRuntime(738): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
12-22 20:52:49.624: E/AndroidRuntime(738): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
12-22 20:52:49.624: E/AndroidRuntime(738): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
12-22 20:52:49.624: E/AndroidRuntime(738): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
12-22 20:52:49.624: E/AndroidRuntime(738): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
12-22 20:52:49.624: E/AndroidRuntime(738): at android.app.Activity.setContentView(Activity.java:1867)
12-22 20:52:49.624: E/AndroidRuntime(738): at com.Maps.mappv2.MainActivity.onCreate(MainActivity.java:13)
12-22 20:52:49.624: E/AndroidRuntime(738): at android.app.Activity.performCreate(Activity.java:5008)
12-22 20:52:49.624: E/AndroidRuntime(738): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
12-22 20:52:49.624: E/AndroidRuntime(738): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
12-22 20:52:49.624: E/AndroidRuntime(738): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
12-22 20:52:49.624: E/AndroidRuntime(738): at android.app.ActivityThread.access$600(ActivityThread.java:130)
12-22 20:52:49.624: E/AndroidRuntime(738): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
12-22 20:52:49.624: E/AndroidRuntime(738): at android.os.Handler.dispatchMessage(Handler.java:99)
12-22 20:52:49.624: E/AndroidRuntime(738): at android.os.Looper.loop(Looper.java:137)
12-22 20:52:49.624: E/AndroidRuntime(738): at android.app.ActivityThread.main(ActivityThread.java:4745)
12-22 20:52:49.624: E/AndroidRuntime(738): at java.lang.reflect.Method.invokeNative(Native Method)
12-22 20:52:49.624: E/AndroidRuntime(738): at java.lang.reflect.Method.invoke(Method.java:511)
12-22 20:52:49.624: E/AndroidRuntime(738): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
12-22 20:52:49.624: E/AndroidRuntime(738): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-22 20:52:49.624: E/AndroidRuntime(738): at dalvik.system.NativeStart.main(Native Method)
Try clean build both the Library Project and Normal projects First. Is not worked check the following :
i included google-play-services jar library file
You don't have to include the jar. You have to import as android library project.
Import the library project in your workspace
Add it to your project as library
Then build the app
Reason:
The library project has some xml resources. So the project cannot be imported as jar.
java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
As log says styleable cannot be referenced as you haven't built resources.
The R file is a generated one.
From jar u cannot get reference to
Drawables (images)
xml resources [Styles, Strings etc.]
If you are using Android 2.3.3 you need to use SupportMapFragment instead of MapFragment and FragmentActivity instead of Activity.
In the onCreate of your activity you can add the SupportMapFragment...
SupportMapFragment fragment = new SupportMapFragment();
getSupportFragmentManager().beginTransaction()
.add(android.R.id.content, fragment).commit();