Bug 18375 - Automated Test Lib Cannot see Resource.Id
Summary: Automated Test Lib Cannot see Resource.Id
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.13.x
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2014-03-13 18:24 UTC by pperera
Modified: 2017-06-27 00:18 UTC (History)
3 users (show)

Tags: bb
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description pperera 2014-03-13 18:24:10 UTC
Hi, 

We are trying to incorporate Automated Testing using Ranorex. However in a Xamarin based project the testing library cannot see Resource.Id.

A Native based java+Eclipse project works as intended.

http://forums.xamarin.com/discussion/677/automated-testing-frameworks-and-mono-android where I've asked about this issue in the forums.

https://github.com/pperera/Android-Xamarin-Ranorex-Evaluation where my test projects reside that show this.

Cheers, 

Peter.
Comment 1 Jonathan Pryor 2014-03-14 10:10:59 UTC
I don't understand the question.

1. Resource.id is created:
https://github.com/pperera/Android-Xamarin-Ranorex-Evaluation/blob/master/ShoppingList_Projects/ShoppingList_Xamarin/ShoppingList/Resources/Resource.designer.cs#L60

2. Your sample has only one project, and it's an Application project, not a Library project or Test project.

What is the Automated Test Lib? Where is it? How is it generated? What's the workflow?

I don't know anything about Ranorex, so I don't know how it's supposed to work. Assuming it wants access to an R.java class, one is created as part of the build process, e.g.

obj/Debug/android/shoppinglist/shoppinglist/R.java

/* AUTO-GENERATED FILE.  DO NOT MODIFY.
 *
 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
 */

package shoppinglist.shoppinglist;

public final class R {
    public static final class attr {
    }
    public static final class drawable {
        public static final int icon=0x7f020000;
    }
    public static final class id {
        public static final int MyShoppingList=0x7f050000;
    }
    public static final class layout {
        public static final int main=0x7f030000;
    }
    public static final class string {
        public static final int app_name=0x7f040001;
        public static final int hello=0x7f040000;
    }
}

Furthermore, if your extract the .apk and `dexdump classes.dex`, R is in there:

$ dexdump classes.dex | grep 'Class descriptor.*\/R$id'
  Class descriptor  : 'Lshoppinglist/shoppinglist/R$id;'

Perhaps Ranorex is looking at the wrong package for the R type?
Comment 2 pperera 2014-03-20 17:59:49 UTC
Hi Jonathon, 

Ranorex Studio adds the Ranorex Library to an apk post Xamarin build time.

Ranorex have identified and we have confirmed that in Xamarin based Android apk's the package name in AndroidManifest.xml is converted to lowercase while in Eclipse based projects case is maintained.
Comment 3 Chris Hardy [MSFT] 2017-06-26 17:51:37 UTC
Thank you for taking the time to submit this report. Are you are still experiencing the issue after updating to the latest version of Xamarin.Android? If so, please reopen this report with an attached reproduction or steps to reproduce the issue. Thanks!