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
Related
In the following code, android:progressTint="#c9c9c9", android:secondaryProgressTint="#bebebe" and android:thumbTint="#a9a9a9" are API Level 21 features. However, I am currently using com.android.support:appcompat-v7:23.1.1. Will my app run on devices lower than API 21?
<SeekBar
android:id="#+id/teacher_intro_seekbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:progress="10"
android:paddingRight="10dp"
android:progressTint="#c9c9c9"
android:secondaryProgressTint="#bebebe"
android:thumbTint="#a9a9a9" />
Yes they will work for API 21 and above, For lower versions they will be ignored. If you want for all versions use app compat seekbar as below.
<android.support.v7.widget.AppCompatSeekBar
android:id="#+id/teacher_intro_seekbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:progress="10"
android:paddingRight="10dp"
app:progressTint="#c9c9c9"
app:secondaryProgressTint="#bebebe"
app:thumbTint="#a9a9a9" />
It will run, but it may not look correct. XML properties not recognized are ignored. In this case they will definitely be ignored- you aren't using an app compat version of Seekbar, so the compatibility library doesn't matter. (I don't know if there is an app compat version of seekbar, but even if there is you aren't using it).
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)
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".
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.
I faced this strange problem.
On my layout xml, I have a single TextView, and in it I have the following text:
"Welcome to App.\n etc" , defined in strings.xml.
In a tablet running 4.0 displays the full string.
In a smartphone running 2.3.7 it displays just before the \n.
On previous apps I have created, \n worked okay.
Anybody faced something similar?
XML Code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="#+id/textViewWelcomeNotes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="false"
android:layout_centerHorizontal="true"
android:layout_centerVertical="false"
android:layout_margin="15dp"
android:layout_marginTop="20dp"
android:fitsSystemWindows="false"
android:focusableInTouchMode="true"
android:gravity="center_vertical|center_horizontal"
android:hint="#string/msgWelcomeNotesHint"
android:paddingTop="10dp"
android:text="#string/msgWelcomeNotes"
android:textSize="14dp" />
</RelativeLayout>
It was a weird bug of latest ADT 20.0, in Eclipse Juno.
I made a fresh install of Eclipse Juno, because i heavily loaded it with plugins,
and now \n appears okay, in the same apk, on 2.3 and 4.0+ Android Versions.
Also some other bugs, eg when creating new activity (New->Other->Android Activity), exist on this ADT.