Visual Studio 2017-Xamarin-文件``obj \ Debug \ android \ bin \ packaged_resources''不存在 [英] Visual Studio 2017 - Xamarin - The file "obj\Debug\android\bin\packaged_resources" does not exist

查看:62
本文介绍了Visual Studio 2017-Xamarin-文件``obj \ Debug \ android \ bin \ packaged_resources''不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为该问题奋斗了2天,找不到任何解决方案.

我在Visual Studio 2017中有一个Xamarin Android应用程序,该应用程序包含三个项目:

  1. Xamarin.Android项目(主要项目)
  2. 特定于Android的单元测试在设备上运行-使用

    按照其他SO线程的建议,我尝试卸载最新的 Android SDK构建工具(25.0.2),并安装了23.0.3版(我的所有项目都针对Android 6.0),但是没有帮助,我仍然有相同的错误.

    也许值得一提的是,当我尝试在应用程序中阅读教程,他们建议在SDK Manager中安装 Android 7.1.1(API 25).但是之后,我撤消了所有更改,甚至重新安装了VS2017 + Xamarin.

    您还有其他想法吗?我真的很感谢您的帮助.谢谢!

    编辑2017-04-09:

    Egh,我删除了VS2017,并使用全新的Android SDK安装了VS2015,并且仍然遇到了同样的问题:(

    解决方案

    我终于找到了问题所在.它与SDK Manager或VS版本中的任何组件都不相关.

    按照来自developer.xamarin.com的本地化教程,我播放了在我的Android项目中与 Strings.xml 一起使用.我也想从资源中获取我的活动标签",因此在我定义的 ActivityAttribute 中:

      [活动(标签="@ string/peopleListTitle")] 

    并将此值添加到 Strings.xml 文件中:

     <?xml version ="1.0" encoding ="utf-8"?><资源><!-------其他资源值----->< string name ="peopleListTitle">人物列表</string></resources> 

    在这种情况下,我的构建因上述错误而失败:

    文件"obj \ Debug \ android \ bin \ packaged_resources"不存在

    当我将 ActivityAttribute 更改为直接使用字符串时:

      [活动(标签=人员列表")] 

    构建顺利进行,没有任何问题.

    我设法找到一个解决方案,但实际上我不知道为什么当我尝试使用在 Strings.xml 中定义的Label文本时.

    顺便说一句,我设法通过在 Tools-> Options-> Projects and Solutions-> Build and Run 中将构建输出详细程度设置为 Diagnostic 来找到问题所在为什么在输出"窗口中构建失败的详细信息.

    I'm fighting with that issue for 2 days already and can't find any solution.

    I have an Xamarin Android app in Visual Studio 2017 consisting of three projects:

    1. Xamarin.Android project (main one)
    2. Android-specific unit tests run on the device - project of type NUnit 3 Test Project (Android) created using NUnit Templates for Visual Studio
    3. Platform-independent unit tests project (project of type Unit Test Project (.NET Framework))

    Everything worked just fine until now. When I selected my main project as the Startup one, my app was deployed to the device/emulator. When I selected my Android-specific unit tests project, the test project was deployed and unit tests executed by nUnit Xamarin Runners on the device/emulator.

    However few days ago I updated my Visual Studio 2017 with the newest available update and now, when trying to build this android-specific unit tests project I get the following error:

    The file "obj\Debug\android\bin\packaged_resources" does not exist.

    I've searched everywhere, including this and this SO topics. I also totally reinstalled Visual Studio 2017 and Xamarin with Android SDK included. Nothing helped. From what I read I suspect there is something wrong with the versions of Android SDK Build-tools I have installed. Here's what I have currently installed in SDK Manager:

    As the other SO threads suggested, I tried uninstalling the newest Android SDK Build-tools (25.0.2) and installed version 23.0.3 (all my projects target Android 6.0), but it also doesn't help, I still have the same error.

    Maybe it's worth adding that this issue may have started to happen when I tried to implement RecyclerView in my app reading this tutorial, where they suggested to install Android 7.1.1 (API 25) in SDK Manager. However I undoed my all changes after that and even reintalled VS2017 + Xamarin.

    Do you have any other idea why this can be ? I'd really appreciate any help. Thanks!

    EDIT 2017-04-09:

    Egh, I removed VS2017, installed VS2015 with brand new Android SDK and still the same issue :(

    解决方案

    I've finally found what was the issue. It wasn't related to any component from SDK Manager or VS version.

    Following localization tutorial from developer.xamarin.com, I played a bit with Strings.xml in my Android project. I wanted to have my Activities Label taken from resources as well, so in the ActivityAttribute I defined:

    [Activity(Label = "@string/peopleListTitle")]
    

    and added this value in Strings.xml file:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <!-------Other resources values ----->
        <string name="peopleListTitle">People List</string>
    </resources>
    

    In that case my build is failing with above-mentioned error:

    The file "obj\Debug\android\bin\packaged_resources" does not exist

    When I change ActivityAttribute to use a string directly:

    [Activity(Label = "People List")]
    

    the build is passing without any issues.

    I managed to find a solution, but actually I don't know why it's not building when I try to use Label text defined in Strings.xml.

    BTW, I managed to find what's the problem by setting build output verbosity to Diagnostic in Tools -> Options -> Projects and Solutions -> Build and Run which gives a detailed info why the build failed in the Output window.

    这篇关于Visual Studio 2017-Xamarin-文件``obj \ Debug \ android \ bin \ packaged_resources''不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆