I found that there are following statement in package/apps/UnifiedEmail package in android source code:
<add-resource name="RecipientEditTextViewStyle" type="style" />
What does this "add-resource" element mean?
The source code: https://github.com/CyanogenMod/android_packages_apps_UnifiedEmail/blob/cm-11.0/res/values/attrs.xml
<resources>
<string name="app1_name">MyAppName</string>
</resources>
is the same thing as
<resources>
<add-resource type="string" name="app1_name">MyAppName</add-resource>
</resources>
so
<add-resource name="RecipientEditTextViewStyle" type="style" />
is the same thing as
<style name = "RecipientEditTextViewStyle"/>
Related
I've setup EmojiCompat Following the documention I have the files
Import
implementation 'androidx.emoji:emoji:1.1.0'
font_certs.xml - Auto Generated
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="com_google_android_gms_fonts_certs">
<item>#array/com_google_android_gms_fonts_certs_dev</item>
<item>#array/com_google_android_gms_fonts_certs_prod</item>
</array>
<string-array name="com_google_android_gms_fonts_certs_dev">
<item>
MIIEqDCCA5CgAwIBAgIJANWFuGx9.......
</item>
</string-array>
<string-array name="com_google_android_gms_fonts_certs_prod">
<item>
MIIEQzCCAyugAw....
</item>
</string-array>
</resources>
preloaded_fonts.xml - Auto Generated
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="preloaded_fonts" translatable="false">
<item>#font/montserrat_bold_downloadable</item>
</array>
</resources>
montserrat_bold_downloadable - Auto Generated
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="name=Montserrat&weight=700"
app:fontProviderCerts="#array/com_google_android_gms_fonts_certs">
</font-family>
And now when calling to initialise this it's failing, but the callback returns null so I dug through to see where it was failing.
EmojiCompat.init(
FontRequestEmojiCompatConfig(
this,
FontRequest(
"com.google.android.gms.fonts",
"com.google.android.gms",
"name=Montserrat",
R.array.com_google_android_gms_fonts_certs
)
).setReplaceAll(true)
)
The error that it's throwing internally is;
android.content.pm.PackageManager$NameNotFoundException: No package found for authority: com.google.android.gms.fonts
I can't find anything to do with this issue anywhere.
I am trying the solution here by adding support-annotations and putting the following line in the dependencies block of your build.gradle file and adding com.android.application or com.android.library in gradle.
developer.android.com/studio/write/annotations.html
But the problem symbols, (1000) and (1001), are still red here:
TileView tvOne = new TileView(getContext());
tvOne.setClickable(false);
tvOne.setSelected(matchView.isSelected());
// tvOne.setEnabled(false);
tvOne.setTile(matchView.getTile());
tvOne.setId(1000);
TileView tvTwo = new TileView(getContext());
tvTwo.setClickable(false);
tvTwo.setSelected(otherView.isSelected());
// tvTwo.setEnabled(false);
tvTwo.setTile(otherView.getTile());
tvTwo.setId(1001);
I'm supposing that TileView is subclass of android.view.View.
So, the parameter to method .setId should be declared as resource id.
eg.
Create a resource file
src/main/res/values/ids.xml
With content
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="tileViewOne" type="id" />
<item name="tileViewTwo" type="id" />
</resources>
Then you set.
tvOne.setId(R.id.tileViewOne);
tvTwo.setId(R.id.tileViewTwo);
1000 and 1001 marked RED i did that
<?xml version="1.0" encoding="utf-8"?>
<resources> <item name="tileViewOne" type="id" />
<item name="tileViewTwo" type="id" />
</resources>
and that
TileView tvOne = new TileView(getContext());
tvOne.setClickable(false);
tvOne.setSelected(matchView.isSelected());
// tvOne.setEnabled(false);
tvOne.setTile(matchView.getTile());
tvOne.setId(R.id.tileViewOne);
TileView tvTwo = new TileView(getContext());
tvTwo.setClickable(false);
tvTwo.setSelected(otherView.isSelected());
// tvTwo.setEnabled(false);
tvTwo.setTile(otherView.getTile());
tvTwo.setId(R.id.tileViewTwo);
I have the following error:
From menu:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:appcompat="http://schemas.android.com/apk/res-auto">
<item
android:id="#+id/menu_item_new"
android:title="#string/menu_item_new"
appcompat:showAsAction="always"></item>
<item
android:id="#+id/menu_item_save"
android:title="#string/menu_item_save"
appcompat:showAsAction="always"></item>
<item
android:id="#+id/menu_item_delete"
android:title="#string/menu_item_delete"
appcompat:showAsAction="always"></item>
<item
android:id="#+id/menu_item_rate"
android:title="#string/menu_item_rate"></item>
<item
android:id="#+id/menu_item_website"
android:title="#string/menu_item_website"></item>
<item
android:id="#+id/menu_item_report"
android:title="#string/menu_item_report"></item>
</menu>
Even though all those strings do in fact exist:
<string name="menu_item_new">New</string>
<string name="menu_item_save">Save</string>
<string name="menu_item_delete">Cancel</string>
<string name="menu_item_rate">Rate on Google Play</string>
<string name="menu_item_website">Website</string>
<string name="menu_item_report">Report a Bug</string>
I have attempted to simply re-write the code as well as clean and rebuild, yet the error persists.
How can this be resolved?
resources tag is missing from strings.xml file.
Android couldn't locate the string resource.
Make following changes:
<resources>
<string name="menu_item_new">New</string>
<string name="menu_item_save">Save</string>
<string name="menu_item_delete">Cancel</string>
<string name="menu_item_rate">Rate on Google Play</string>
<string name="menu_item_website">Website</string>
<string name="menu_item_report">Report a Bug</string>
</resources>
I'm working with android studio to develop Android app. I'm working on the creation of a template to use in my applications. I have read the Android IDE Template Format specification and so i start my personal template starting from Dummy template.
I have a .ftl file with the following line of code:
<applicationGestureListenerClazz>${projectPackageName}.listeners.${projectShortName}GestureListener</applicationGestureListenerClazz>
When i execute the template i obtain the following line:
<applicationGestureListenerClazz>org.abubu.dummy.listeners.DummyGestureListener
</applicationGestureListenerClazz>
The variables are correctly defined (in other file they work fine). I don't known why.. it add a CRLF after this line.
Anybody has analogue problem?
UPDATE
I discover that the problem is linked to extension of output file. For example. I have a file **license_key_strings.txt.ftl* that contains:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- public key di ${projectPackageName}.key-->
<string name="publicKey">${licenseKey}</string>
</resources>
<!-- fine -->
If i use it to create a xml file
<instantiate from="root/key/src/main/res/values/license_key_strings.txt.ftl" to="${keyBaseDir}/src/main/res/values/license_key_strings.xml"/>
I obtain this file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- public key di org.dummy.key-->
<string name="publicKey">
MIIBIjANBgkqhkiG9w0BAQ
</string>
</resources>
But the output filename ends with .txt
<instantiate from="root/key/src/main/res/values/license_key_strings.txt.ftl" to="${keyBaseDir}/src/main/res/values/license_key_strings.txt"/>
The final output become:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- public key di org.dummy.key-->
<string name="publicKey">MIIBIjANBgkqhkiG9w0BAQ</string>
</resources>
<!-- fine -->
I'm working with Android Studio 1.4
I must make a few translations for my app.
But when I compile my app, console write:
[2012-11-24 15:31:43 - com.ddm.ctimer.MainForm] W/ResourceType( 4892): Bad XML block: header size 297 or total size 0 is larger than data size 0
[2012-11-24 15:31:43 - com.ddm.ctimer.MainForm] C:\Users\Roman\Desktop\NewTimer\NewTimer\res\values-fr\strings.xml:6: error: Found text "
[2012-11-24 15:31:43 - com.ddm.ctimer.MainForm] В В В В " where item tag is expected
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">CTimer</string>
<!--RUS strings-->
<!--MainForm-->
<string name="main_form_sec">Chronomètre</string>
<string name="main_form_tim"> Minuterie </string>
<string name="main_form_set"> Paramètres </string>
<string name="main_form_bg">#000000</string>
<!--Menu-->
<string name="menu_about">À propos du programme</string>
<string name="menu_buy">Supprimer les annonces</string>
<!--Preferences(Settings)-->
Most probably you have a problem with the encoding, resource files are supposed to be encoded in UTF-8.
Please, try to replace "Chronomètre" with something in plain English and see if your error disappears or moves to the next "translated" line.
It's better to use colors.xml for colors:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="main_form_bg">#000000</color>
</resources>