My android app is complaining about resource missing, which I do think has been included and worked great in previous version of android.
e.g.,
menu.xml:27: error: Error: No resource found that matches the given name (at 'title' with value '#string/lookup_about').
<item
android:id="#+id/about"
android:title="#string/lookup_about"
android:icon="#drawable/ic_menu_help"/>
In string.xml, I've defined
<string name="lookup_about">About</string>
Update:
I found that in one case, only the 2nd #string/spinder_prompt was complained by eclipse. The first one is not
<TextView
android:id="#+id/refresh"
android:text="#string/spinder_prompt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="16dip"
android:typeface="sans"
android:layout_gravity="left"
android:textColor="#ffffff"
/>
<Spinner android:id="#+id/Spinner01"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:prompt="#string/spinder_prompt"
android:layout_weight="0.02"/>
In my strings.xml,
<string name="spinder_prompt">Choose the number of items to show</string>
FYI. This code was built and deployed and tested on Android 2.2 systems without any issues.
Problem solved. The reason is due to the upgrade from 2.1-> 3.0. The automatically generated R.java cannot update itself, one has to "edit" that file and save it. Then problem solved. Developers are experiencing similar issues...http://www.coderanch.com/t/466092/Android/Mobile/android-eclipse
Related
Compiler is showing Error in these lines: I can't seems to locate the problem kindly help me.
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toRightOf="#id/ic_magnify"
android:layout_centerVertical="true"
android:textSize="15sp"
android:textColor="#000"
android:id="#+id/input_search"
android:background="null"
android:hint="Enter Address, City or Zip Code"
android:imeOptions="actionSearch" />
android:background="null" doesn't mean anything. You need to use android:background="#null".
In the future showing your actual error (likely something similar to the error below) will help people actually be able to help you, instead of guessing.
fragment_dashboard.xml:219: error: 'null' is incompatible with attribute background (attr) reference|color
When I build my app regularly, it builds with no errors. When I try to build the SIGNED APK, I get an error...
Error: Expected resource of type id [ResourceType]
The line of code that is flagged is...
tv = (TextView)myView.findViewById(R.id.tvTimestamp);
That ID is defined in the corresponding layout xml as follows:
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
>
<!-- Clock -->
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:src="#drawable/ic_clock_white"
android:layout_gravity="center_vertical"
/>
<TextView
android:id="#+id/tvTimestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textSize="14sp"
android:layout_marginLeft="20dp"
/>
</FrameLayout>
Not sure why this one is erroring out.
Thanks
Pete
That is not a compiler error, it's a lint warning.
To solve it, try one of the following:
Clean your project and sync it again
Use View.generateViewId() to set an arbitrary id
Create an ids.xml file in res/values/
If the debug version is running correctly on the emulator/physical device then you can safely go ahead and suppress this warning by:
Clicking on the error and selecting Disable error
Adding the following lines in build.gradle
android {
lintOptions{
disable "ResourceType"
}
}
When I open layout editor, eclipse is giving this error:
parseSdkContent failed
Could not initialize class android.graphics.Typeface
And when I try to run project, it is giving this error :
An internal error occurred during: "Launching myapp".
java.lang.NullPointerException
Every time I'm getting this error and I have to restart eclipse. Is there any solution? This problem started suddenly today.
XML file:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#66000000"
>
<RelativeLayout
android:id="#+id/refresh_match_layout"
android:layout_width="fill_parent"
android:layout_height="150dp"
android:layout_centerInParent="true"
android:layout_margin="15dp"
android:background="#drawable/app_detay_lay_bg"
android:orientation="vertical"
android:padding="10dp"
android:visibility="visible" >
<ImageView
android:id="#+id/app_icon"
android:layout_width="50dp"
android:layout_height="50dp"
android:padding="10dp"
android:textColor="#ffffff"
android:textSize="20sp" />
<TextView
android:id="#+id/app_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:textColor="#000000"
android:layout_toRightOf="#+id/app_icon"
android:layout_marginTop="2dp"
android:textSize="20sp" />
<ImageButton
android:id="#+id/app_detail_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="2dp"
android:background="#null"
android:src="#drawable/settings_detail"/>
<ImageButton
android:id="#+id/app_remove_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/app_icon"
android:layout_alignTop="#+id/app_detail_button"
android:background="#null"
android:src="#drawable/settings_remove" />
</RelativeLayout>
</RelativeLayout>
Error picture:
I deleted the home/.android folder and everything is normal now.
In Windows you can find this folder in C:/Users/User/
Source: https://stackoverflow.com/a/5883841/3681056
Note: it happens when you have 2 versions of SDK and eclipse, both in the same computer (and using the same .android file), if you open on version the other will get this error.
Deleting ".android" is temporarily fixing the problem with me as after sometime it begins to come again ..
Here is another cause and fix that might help .. This is happening because of existence of 2 versions of SDK in the same machine but in case you have only one version (probably it is 21) just download the SDK platform for API 20 (4.4W) as there is a problem in 21's "layoutlib.jar"). start applying the following:
Close Eclipse
Navigate to your sdk folder (something like C:\adt-bundle-windows-x86_64-20140321\sdk)
Go to platforms folder -> android-21 folder -> data folder and rename layoutlib.jar (for backup only)
Copy the same file (layoutlib.jar) from your android-20 folder to this folder "android-21"
Start Eclipse
deleting home/.android is useless, i delete ~/.android/avd it worked for me :)
I was getting this error too
parseSdkContent failed
Could not initialize class android.graphics.Typeface
But I could only resolve it after changing my Eclipse ADT from 64 bit to 32 bit on Windows 7 64 bit OS.
I use Eclipse 4.3.0 with the latest Android SDK.
I have a textview which looks like this:
<TextView
android:id="#+id/list_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:onClick="onSave"
android:textIsSelectable="false"
android:textAppearance="?android:attr/textAppearanceLarge" />
I added the line android:textIsSelectable="false" manually because lint gave me a warning and I hate to have warnings. The warning goes away. However, as soon as I edit something in the layout, an error appears saying:
error: No resource identifier found for attribute 'textIsSelectable' in package 'android'
I have to go to the file, remove the line, the error disappears and the warning returns. Then I reinsert the line again, and the error AND the warning is gone, until next time I have to edit something.
This property is also not showing up anywhere in the editor screen, so maybe that is the reason, but then, how can I get rid permanently of this error loop? Or is this a bug in the SDK environment?
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.