I've got some problems with autoLink="phone" option of TextView.
My UI:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/TableLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/personPhone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="phone"
android:text="test" />
</TableLayout>
When i switching to Graphical Layout (in ADT) im getting following error:
Exception raised during rendering: com/android/i18n/phonenumbers/PhoneNumberUtil
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- TextView (Change to android.widget.TextView, Fix Build Path, Edit XML)
Error in log:
java.lang.NoClassDefFoundError: com/android/i18n/phonenumbers/PhoneNumberUtil
at android.text.util.Linkify.gatherTelLinks(Linkify.java:451)
at android.text.util.Linkify.addLinks(Linkify.java:230)
at android.widget.TextView.setText(TextView.java:3700)
at android.widget.TextView.setText(TextView.java:3622)
at android.widget.TextView.<init>(TextView.java:1259)
at android.widget.TextView.<init>(TextView.java:607)
at sun.reflect.GeneratedConstructorAccessor16.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at android.view.BridgeInflater.onCreateView(BridgeInflater.java:86)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:131)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:373)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:385)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:332)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:440)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1545)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1302)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:1059)
at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegatePageChange(LayoutEditorDelegate.java:686)
at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.pageChange(CommonXmlEditor.java:360)
at org.eclipse.ui.part.MultiPageEditorPart$2.widgetSelected(MultiPageEditorPart.java:292)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3028)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1749)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:278)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
If i remove
android:autoLink="phone"
error disappears.
Also if i change "phone" to "email", there wouldn't any errors, but "all" cause the same error.
I have the same behavior when i use API level 18 to render the view. It won't affect your program. As a workaround you can change the "API version to use when rendering in Eclipse" to 16 rather than 18 while working with layouts that include autolink. There is a button above the graphical view with a robot icon and a number which you can use to change that.
This bug also occurs in Android Studio and is being tracked in Android's issue tracker at http://code.google.com/p/android/issues/detail?id=59497.
I have simple solution. you can use
tools: name space to override android name space for example you can use next code sample
<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">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="all"
tools:autoLink="none"
/>
You need only that xmlns:tools="http://schemas.android.com/tools" and tools:autoLink="none"
This will be applyed only for preview rendering, you cant found that attributes on runtime
Also you can use that name space for other attributes, for ex.:
tools:text="Some text that visible only on preview"
Related
I added this object to my xml layout
<android.view.ext.SatelliteMenu
android:id="#+id/menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
sat:closeOnClick="true"
sat:expandDuration="500"
sat:mainImage="#drawable/ic_launcher"
sat:satelliteDistance="170dp"
sat:totalSpacingDegree="90" >
</android.view.ext.SatelliteMenu>
and recieve this error :
The following classes could not be instantiated:
- android.view.ext.SatelliteMenu (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.
so i look in Log and i got these details
android.content.res.Resources$NotFoundException: Could not resolve resource value: 0x7F030015.
at android.content.res.BridgeResources.throwException(BridgeResources.java:693)
at android.content.res.BridgeResources.getLayout(BridgeResources.java:271)
at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
at android.view.ext.SatelliteMenu.init(SatelliteMenu.java:78)
at android.view.ext.SatelliteMenu.<init>(SatelliteMenu.java:69)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:422)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:179)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:135)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:746)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:718)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:372)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:385)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:332)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:440)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderPreview.renderSync(RenderPreview.java:560)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderPreview.access$5(RenderPreview.java:506)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderPreview$RenderJob.runInUIThread(RenderPreview.java:1230)
at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:95)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4144)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414
)
that this mean ?
when i run this project in the first time the object work fine and after this it do troubles
OPTION #1:
Sometimes, when a new resource is added, Eclipse doesn't compile correctly the new code (maybe a caching issue), causing this error.
Normally, simply restarting Eclipse is enough to fix the problem.
OPTION #2:
Sometimes, rendering custom views causes this exception. The only workaround I know is checking View.isInEditMode every time you try to use the getResources().
An example could be:
if (isInEditMode()) {
//do something else, as getResources() is not valid.
} else {
//you can use getResources()
String mystring = getResources().getString(R.string.mystring);
}
I am working with Phonegap, cordova-2.0.0 in an Android application. I want to use org.apache.cordova.CordovaWebView in my main layout. My main layout looks like the xml below.
Layout XML:
<RelativeLayout 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" >
<org.apache.cordova.CordovaWebView
android:id="#+id/mainView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
/>
</RelativeLayout>
It is very simple test application and I followed the steps from http://docs.phonegap.com/en/2.0.0/guide_cordova-webview_android.md.html.
I followed all steps except creating cordova-x.x.x.jar file. I got cordova-2.0.0.jar from phonegap download and copied this jar file to the \libs folder.
If I remove the org.apache.cordova.CordovaWebView element from main layout, then it runs without exception.
Run as Android application produces the following error output.
eclipse.buildId=M20120914-1800
java.version=1.7.0_03
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments: -os win32 -ws win32 -arch x86_64
Error
Thu Oct 04 21:13:45 PDT 2012
org.apache.cordova.CordovaWebView failed to instantiate.
java.lang.NullPointerException
at org.apache.cordova.CordovaWebView.loadConfiguration(CordovaWebView.java:600)
at org.apache.cordova.CordovaWebView.<init>(CordovaWebView.java:121)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:402)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:166)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:135)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:746)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:718)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:372)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:321)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:331)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:372)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1638)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1389)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:1163)
at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegatePageChange(LayoutEditorDelegate.java:674)
at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.pageChange(CommonXmlEditor.java:360)
at org.eclipse.ui.part.MultiPageEditorPart$2.widgetSelected(MultiPageEditorPart.java:292)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3023)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1730)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:270)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1029)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:923)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
It's an old topic but as I had the same problem and I could resolve it, I post the solution that permitted me to solve the problem if anyone has the same problem.
In the overrided function, getActivity() from CordovaInterface in the MainActivity, you have to implement it at less with these lines:
#Override
public Activity getActivity() {
return this;
}
Looks like config.xml is missing from your res/xml directory in your Android app.
I'm using android 3.0 and I try to create bitmap xml that will create a background by repeat of a pattern.
I called it pattern_4_4_repeat.xml and it is located in 'drawable':
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="#drawable/pattern_base"
android:tileMode="repeat">
</bitmap>
It is working well and looks good when I run it. The problem is that I get an error in the Error Log that says the following:
org.xmlpull.v1.XmlPullParserException: Binary XML file line #4: <bitmap> requires a valid src attribute
at android.graphics.drawable.BitmapDrawable.inflate(BitmapDrawable.java:382)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:832)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:769)
at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:208)
at com.android.layoutlib.bridge.android.BridgeTypedArray.getDrawable(BridgeTypedArray.java:775)
at android.view.View.<init>(View.java:2471)
at android.view.ViewGroup.<init>(ViewGroup.java:366)
at android.widget.LinearLayout.<init>(LinearLayout.java:156)
at android.widget.LinearLayout.<init>(LinearLayout.java:152)
at sun.reflect.GeneratedConstructorAccessor40.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at android.view.LayoutInflater.createView(LayoutInflater.java:576)
at com.android.layoutlib.bridge.android.BridgeInflater.onCreateView(BridgeInflater.java:84)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:644)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
at com.android.layoutlib.bridge.android.BridgeInflater.createViewFromTag(BridgeInflater.java:129)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:83)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:702)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:86)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:702)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:86)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:702)
at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
at android.view.LayoutInflater.inflate(LayoutInflater.java:367)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:321)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:372)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1317)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1071)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart$ReloadListener.reloadLayoutSwt(GraphicalEditorPart.java:1533)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart$ReloadListener.access$0(GraphicalEditorPart.java:1471)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart$ReloadListener$1.run(GraphicalEditorPart.java:1465)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
I don't understand what am I missing here.
Thanks for your help
problem seems that #drawable/pattern_base is invalid (logcat says requires a valid src attribute )
ensure that drawable folder contains image with same name.
The problem was solved.
I've used ADT v14 when I had the problem, but after updating the ADT to v15 the error stopped showing in the Error Log.
So I just installed the Android SDK and the ADT addon for eclipse and ran into a problem.
When I go to the graphical layout in main.xml no layout shows up. Instead I just get this error
$java.lang.NullPointerException
at sun.awt.FontConfiguration.getInitELC(Unknown Source)
at sun.awt.FontConfiguration.initFontConfig(Unknown Source)
at sun.awt.FontConfiguration.<init>(Unknown Source)
at sun.awt.windows.WFontConfiguration.<init>(Unknown Source)
at sun.awt.Win32GraphicsEnvironment.createFontConfiguration(Unknown Source)
at sun.java2d.SunGraphicsEnvironment$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.java2d.SunGraphicsEnvironment.<init>(Unknown Source)
at sun.awt.Win32GraphicsEnvironment.<init>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(Unknown Source)
at sun.font.FontDesignMetrics.getDefaultFrc(Unknown Source)
at sun.font.FontDesignMetrics.getMetrics(Unknown Source)
at sun.awt.SunToolkit.getFontMetrics(Unknown Source)
at sun.awt.windows.WToolkit.getFontMetrics(Unknown Source)
at android.graphics.Paint_Delegate.updateFontObject(Paint_Delegate.java:1062)
at android.graphics.Paint_Delegate.reset(Paint_Delegate.java:1039)
at android.graphics.Paint_Delegate.<init>(Paint_Delegate.java:991)
at android.graphics.Paint_Delegate.native_init(Paint_Delegate.java:614)
at android.graphics.Paint.native_init(Paint.java)
at android.graphics.Paint.<init>(Paint.java:194)
at android.graphics.Paint.<init>(Paint.java:184)
at android.view.ViewGroup.<init>(ViewGroup.java:278)
at android.widget.LinearLayout.<init>(LinearLayout.java:116)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:227)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:318)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:372)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1317)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1071)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart$ConfigListener.onConfigurationChange(GraphicalEditorPart.java:493)
at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.onRenderingTargetChange(ConfigurationComposite.java:2192)
at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.access$4(ConfigurationComposite.java:2157)
at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite$2.widgetSelected(ConfigurationComposite.java:441)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
It doesnt matter what android version I am in I still get this error. I have tried uninstalling the SDK and the addon and to no avail. I am using SDK r14 tools and the ADT 14.0.
Anyone got any suggestions
Does it happen as soon as you open the XML file?
It may be worth checking the source in the XML file. Open the directory to where the file is contained and edit it (in Notepad etc) and just paste the following:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi, did this work?" />
</LinearLayout>
That's about as simple as it gets. If that works, you know the XML in your current main.xml is wrong.
May also be worth rebuilding/cleaning your project.
Hi. I'm adding a background xml file to an Imageview but i get this error in the Eclipse Graphical layout:
error! Unable to resolve drawable
"com.android.ide.common.rendering.api.ResourceValue#1ae0c2"
in attribute "background" Exception
details are logged in Window > Show
View > Error Log
When i run the widget on the device, the background is displayed in the right way, but the error in Eclipse is really annoying. The background file is:
<?xml version="1.0" encoding="utf-8"?>
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="#drawable/grey_back_tile"
android:tileMode="repeat" />
And here's where I use it:
<ImageView android:layout_gravity="top|center_horizontal" android:layout_marginTop="4dp" android:layout_width="286dp" android:layout_height="47dp" android:background="#drawable/widget_background_banner"/>
The error log stack trace shows:
org.xmlpull.v1.XmlPullParserException:
Binary XML file line #5:
requires a valid src attribute at
android.graphics.drawable.BitmapDrawable.inflate(BitmapDrawable.java:341)
at
android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:779)
at
android.graphics.drawable.Drawable.createFromXml(Drawable.java:720)
at
com.android.layoutlib.bridge.ResourceHelper.getDrawable(ResourceHelper.java:150)
at
com.android.layoutlib.bridge.BridgeTypedArray.getDrawable(BridgeTypedArray.java:668)
at
android.view.View.(View.java:1846)
at
android.widget.ImageView.(ImageView.java:109)
at
android.widget.ImageView.(ImageView.java:105)
at
sun.reflect.GeneratedConstructorAccessor16.newInstance(Unknown
Source) at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source) at
java.lang.reflect.Constructor.newInstance(Unknown
Source) at
android.view.LayoutInflater.createView(LayoutInflater.java:499)
at
android.view.BridgeInflater.onCreateView(BridgeInflater.java:77)
at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:562)
at
android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:122)
at
android.view.LayoutInflater.rInflate(LayoutInflater.java:617)
at
android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
at
android.view.LayoutInflater.inflate(LayoutInflater.java:407)
at
android.view.LayoutInflater.inflate(LayoutInflater.java:296)
at
com.android.layoutlib.bridge.Bridge.computeLayout(Bridge.java:377)
at
com.android.ide.common.rendering.LayoutLibrary.createLegacySession(LayoutLibrary.java:394)
at
com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:276)
at
com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(Unknown
Source) at
com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(Unknown
Source) at
com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(Unknown
Source) at
com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(Unknown
Source) at
com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor.partActivated(Unknown
Source) at
com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor.partBroughtToTop(Unknown
Source) at
org.eclipse.ui.internal.PartListenerList$2.run(PartListenerList.java:87)
at
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at
org.eclipse.core.runtime.Platform.run(Platform.java:888)
at
org.eclipse.ui.internal.PartListenerList.fireEvent(PartListenerList.java:57)
at
org.eclipse.ui.internal.PartListenerList.firePartBroughtToTop(PartListenerList.java:85)
at
org.eclipse.ui.internal.PartService.firePartBroughtToTop(PartService.java:208)
at
org.eclipse.ui.internal.WorkbenchPagePartList.firePartBroughtToTop(WorkbenchPagePartList.java:76)
at
org.eclipse.ui.internal.WorkbenchPagePartList.fireActiveEditorChanged(WorkbenchPagePartList.java:52)
at
org.eclipse.ui.internal.PartList.setActiveEditor(PartList.java:162)
at
org.eclipse.ui.internal.WorkbenchPage.makeActiveEditor(WorkbenchPage.java:1281)
at
org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:3530)
at
org.eclipse.ui.internal.WorkbenchPage.requestActivation(WorkbenchPage.java:3077)
at
org.eclipse.ui.internal.PartPane.requestActivation(PartPane.java:279)
at
org.eclipse.ui.internal.EditorPane.requestActivation(EditorPane.java:98)
at
org.eclipse.ui.internal.PartPane.setFocus(PartPane.java:325)
at
org.eclipse.ui.internal.EditorPane.setFocus(EditorPane.java:127)
at
org.eclipse.ui.internal.PartStack.presentationSelectionChanged(PartStack.java:844)
at
org.eclipse.ui.internal.PartStack.access$1(PartStack.java:827)
at
org.eclipse.ui.internal.PartStack$1.selectPart(PartStack.java:137)
at
org.eclipse.ui.internal.presentations.util.TabbedStackPresentation$1.handleEvent(TabbedStackPresentation.java:133)
at
org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:269)
at
org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:278)
at
org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder.access$1(DefaultTabFolder.java:1)
at
org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder$2.handleEvent(DefaultTabFolder.java:88)
at
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at
org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
at
org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:2743)
at
org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1429)
at
org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:257)
at
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at
org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at
org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source) at
java.lang.reflect.Method.invoke(Unknown
Source) at
org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at
org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at
org.eclipse.equinox.launcher.Main.run(Main.java:1407)
Naturally the "grey_back_tile.png" is a valid resource, and it's located int the "drawable-hdpi" folder. Any clue to get rid of that error?
I know I am late to this but faced the same issue. I'm pretty certain it's an Eclipse ADT bug but to prevent the annoying errors, if you create a style and add a background item to your tiled background and refer the layout to that, as opposed to editing the background attribute on the layout, it should work and you won't get the annoying errors.
So, tiled background XML named app_background:
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="#drawable/space" android:tileMode="repeat" />
Then a style, referring to it:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="TestBackground">
<item name="android:background">#drawable/app_background</item>
</style>
</resources>
And then assign the style to the layout:
style="#style/TestBackground"