I'm using Phonegap and Barcode Scanner plugin. I'm trying to build an test application. I'm following below tutorial.
http://www.mobiledevelopersolutions.com/home/start/twominutetutorials/tmt3
I have paste the BarcodeScanner.java to the correct path, as you see in the image.
But when compiling following error happens:
Android Packager: [phonegapbarcode] C:\Users\achintha_s\IdeaProjects\Barcode PhoneGap\AndroidManifest.xml:59: error: Error: No resource found that matches the given name (at 'label' with value '#string/share_name').
How can I solve this? I'm using IntelliJ Studio.
Check the strings.xml in values folder of res folder whether there is a string with name share_name as below:
<string name="share_name">My App Name</string>
and the strings.xml file should like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="share_name">My app Name</string>
</resources>
Make sur you've a stringname share_name in your String.xml file.
<string name="share_name">My App</string>
Related
I had an error when compiling my app
error resource bool fb_auto_log_app_events_enabled managed to fix it
add bool.xml
to android/app/src/main/res/values/bool.xml
the files
<bool name = "fb_auto_log_app_events_enabled"> true </bool>
<bool name = "fb_advertiser_id_collection_enabled"> true </bool>
enter image description here
This issue shows upon running ionic cordova build android, what I did was to add a new file bool.xml inside platforms/android/app/src/main/res/values
inside bool.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="fb_auto_log_app_events_enabled">true</bool>
<bool name="fb_advertiser_id_collection_enabled">true</bool>
</resources>
then run again:
ionic cordova build android
I want to have androidTest resources specific to each app flavor. I found an answer on this site that indicated you can just make a resource directory androidTestFlavorName and it will be managed like all the other resources. So I have a directory app/src/androidTestFlavorName/res/values and a file strings.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="test_sec_code">aStringValue</string>
</resources>
I have a test class app/src/androidTest/java/com/company/package/StartupTest.kt. In that class:
val code = context.getString(R.string.test_sec_code)
test_sec_code is red, so the IDE doesn't like it, and the compiler reports: Unresolved reference: test_sec_code
My selected build variant is flavorNameDebug. So am I setting up these resources wrong, or is my goal not possible?
Edit:
I tried putting the resource in app/src/androidTest/res/values/strings.xml and it can't be found there either. Surely there must be a way to define test resources right? Hello, is this thing on?
I am Stuck in Error: Cannot find symbol variable youtube_url in android studio everything is fine but this error stopping me to build gradle please help.
Remove
activity.getString(R.string.youtube_url)
and write url of youtube video to be shown "www.youtube.com/key"
or
define a string value with name youtube_url in your strings and place url to load
Under your app folder, look for a folder called res then a folder called values then a file called Strings.xml (app/res/values/Strings.xml).
The file likely looks like this:
<resources>
<string name="app_name">My App</string>
</resources>
Inside there you need create another String!
<string name="youtube_url">Hello World</string>
You can read more here:
https://developer.android.com/guide/topics/resources/providing-resources
The first error I got was the String.xml file contains more than one items with same name. It seems to be a common pattern across almost all the system apps you can check it here
The string value will have this format:
<string name="photoPickerNotFoundText" products="xxx">string value</string>
where xxx could be "tablet" or "default", etc.
How could I set up the Gradle to get the project built on my machine?
Thank!
UPDATE
I think that the solution is using the --product option of the aapt (android asset packaging tool). The current gradle android plugin doesn't support this aapt's option yet so maybe modifying the plugin could be a work around.
Every string should be identified by a unique ID. So you could not use same name for every string.
For example the below code wouldn't allow the gradle to build the project
<string name="abc" products="xxx">string value</string>
<string name="abc" products="xxx">string value</string>
Change one of the string ID as shown below
<string name="abc" products="xxx">string value</string>
<string name="def" products="xxx">string value</string>
Update: "You cannot use same string name while building from Eclipse. This type of naming is used only for building apps preloaded on platform. The correct string resource is preloaded according to PRODUCT_CHARACTERISTICS defined for a specific target build."
Reference: Android resource for a specific product
I dowloaded google-play-services from sdk manager and copy pasted all the code from admob samplebut it is not working. Everything seems perfect only errors produced are R can't be resolved to a variable.
Here is a sample error
Error: No resource found that matches the given name (at 'text' with value '#string/load_interstitial').
Here is strings.xml file
<resources>
<string name="app_name">Google Ads SDK Sample</string>
<string name="ad_unit_id">INSERT_YOUR_AD_UNIT_ID_HERE</string>
<string name="load_interstitial">Load Interstitial</string>
<string name="interstitial_not_ready">Interstitial Not Ready</string>
<string name="banner_in_xml">Banner in XML</string>
<string name="banner_in_code">Banner in Code</string>
<string name="interstitial">Interstitial</string>
</resources>
Try to delete the import line import com.your.package.name.app.R, then, any resource calls such as mView= (View) mView.findViewById(R.id.resource_name); will highlight the 'R' with an error, a 'Quick fix' will prompt you to import R, and there will be at least two options:
android.R
your.package.name.R
Select the R corresponding to your package name, and you should be good to go. Hope that helps.
Or.....second region,
Each time I had a problem with R not been generated, or even disappeared, this was due to some problem in the XML layout file that prevented the application from being built.
The error in res folder cause missing of R.java filevso please check your res folder for any error.
The error may be with image too any capital letter or blank space can cause missing of R.java file.
Also check all the XML file ,error with res files only