Couldn't load Main.axml in Xamarin Studio - android

This is the first time of using Xamarin.
I couldn't open Main.axml, in the content tab, in order to modify the application view.
I am able only to display it in source tab.
The error message is "The layout could not be loaded: The operation failed due to an internal error: com.android.ide.common.rendering.api.SessionParams.(Lcom/android...
Does anyone know how to fix it.
Thanks all for your help,

Think the format was just slightly off, try this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="#+id/myButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/hello" />
</LinearLayout>
steps to change:
Remove the semi colon at the end of xmlns:android="schemas.android.com/apk/res/android"
change xmlns:android="schemas.android.com/apk/res/android" to
xmlns:android="http://schemas.android.com/apk/res/android" - Think the removal of the 'http://' might just be the the formatting of StackOverflow comments
finally change "fill_parent" to "match_parent" in both the layout_width and layout_height little info on the difference here

It appears that your Android SDK install is incomplete/corrupt/mis-matched.
If you run the Android SDK manager (or Android Studio), are any errors reported? Use the manager to update to SDK 24.3+
If you still have problems, post the entire log as a gist.github.com (or similar) so we can have a look at the entire trace from XS.
Also are you on Windows or OS-X?
Xamarin Studio
Version 5.9.4 (build 5)
Installation UUID: c9eca622-356f-4681-a1d2-069016cc404f
Runtime:
Mono 4.0.2 ((detached/198235d)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400020004
Xamarin.Android
Version: 5.1.4.8
Android SDK: /Users/administrator/Library/Developer/Xamarin/android-sdk-mac_x86
Supported Android versions:
2.3 (API level 10)
4.0.3 (API level 15)
4.4 (API level 19)
Java SDK: /usr
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

Related

Android Studio shows errors in layout.xml

I'm using data binding library and I experience following issues in Android Studio 3.0:
somelayout.xml:
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="meeting"
type="some.package.MeetingStatusResponse"/>
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#{meeting.title}"
tools:text="Title"
/>
...
</LinearLayout>
</layout>
In this place: android:text="#{meeting.title}" Android Studio 3.0 underlines the # symbol and informs about error:
Error:(29, 27) <expr> or <lambda expression> expected, got '#'
Model class is written in Kotlin if it has any relevance.
The code completion is also not working for bound classes. The application can be successfully build using both, gradle command and Android Studio run app button. So this is just editor issue.
I observe this issue on Mac. On Windows it works ok. I do not have more computers to check if it's platform related issue.
Maybe you forgot to add in gradle compileOptions ?
`sourceCompatibility JavaVersion.VERSION_1_7`
`targetCompatibility JavaVersion.VERSION_1_7`

Android Studio Beta 1.2 issue formatting xml-layout

Recently I’ve upgraded from Android Studio 1 to Android Studio Beta 1.2.
And among other issues, it seems that the shortcut (Option + Command + L) for formatting the xml-layouts it doesn’t reorganice code any more.
In the previous version of Android Studio, if you had something like this:
<RelativeLayout
android:layout_alignParentLeft="true"
android:layout_margin="#dimen/_10dp"
android:id="#+id/rl_avatar"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
After formatting you got the next result:
<RelativeLayout
android:id="#+id/rl_avatar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_margin="#dimen/_10dp">
But now I just get this message: “No lines changed. Code is already properly formatted”
Is there any kind of configuration that I’m missing it?
Thanks!
Try Ctrl+Shift+Alt+L, you should have a dialog where you can tick "Rearrange".

Error while adding text field in Emulator

Whenever I add any TextView in the XML file it shows me the error "Exception raised during rendering: java.lang.System.arraycopy([CI[CII)V".
What is the reasoning behind this?
This is the XML part where the above written error is being shown.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
<requestFocus />
</EditText>
Check the "Android version to use when rendering layouts". Chose any version that does not have "W" at the end . Those versions are for wearable devices.
This problem happened on API 20 (Android 4.4 W). Problem will be solved by changing Android version to use for rendering level form API 20 (Android 4.4 W) to API 19 (Android 4.4.2) (android icon in top right corner of graphical layout) or update your SDK to Android L (API 20 L preview)
Source of answer

XML error - Doing Google Android NDK Lesson 1

The Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:weightSum="1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<EditText android:id="#+id/edit_message"
android:layout_weight = "1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="#string/edit_message" />
<Button
android:id="#+id/bSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/button_send" />
</LinearLayout>
The error message:
BUILD FAILED
C:\My First App\res\layout\activity_main.xml:7: Unexpected element "{}LinearLayout" {antlib:org.apache.tools.ant}LinearLayout
The code is almost exactly the same as the code on the Android website and it's really frustrating that I can't seem to get it to work. Is the problem in the code, or is it on my side? I am using Eclipse
I was getting the same error. I was using Indigo in Ubuntu 12.04, and no matter what libraries I got or eclipse plugins I used it was always there.
What worked for me was re-downloading and reinstalling the Android SDK (probably not necessary in your case), and downloading Eclipse Classic (Juno) from the Eclipse website rather than using the Indigo package that was in the repos. The lesson said Classic was recommended anyway, so whatever, I'm just happy it works now.
If you are using Windows, I'd still suggest downloading the most recent Classic version, but otherwise I can't be of help there.

why eclipses crashes when i try to create a new android xml file

Every time when i try to create a new xml file ,or to open the androidanifest.xml, eclipse crashes . i can't find the solution of this problem . please i need some helpe
i'm using Eclipse SDK Version: 3.7.2 and android sdk r17 windows
after the crash of eclipse, a .log file is generated
A fatal error has been detected by the Java Runtime Environment:
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x4ebac1f6, pid=6136, tid=5600
JRE version: 6.0_31-b05
Java VM: Java HotSpot(TM) Client VM (20.6-b01 mixed mode windows-x86 )
Problematic frame:
C [gdiplus.dll+0x2c1f6]
If you would like to submit a bug report, please visit:
http://java.sun.com/webapps/bugreport/crash.jsp
The crash happened outside the Java Virtual Machine in native code.
See problematic frame for where to report the bug.
......................
Have you ensured your version of Eclipse is completely up to date (Help menu -> Check for Updates)??
Also as Tim mentioned, has this ever worked before? Or has it been an issue since install??

Categories

Resources