Visual Studio 2017中的Visual C ++中的Jar依赖项(程序包不存在) [英] Jar Dependencies (package does not exist) in Visual C++ in Visual Studio 2017

查看:179
本文介绍了Visual Studio 2017中的Visual C ++中的Jar依赖项(程序包不存在)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到一个问题,我无法在

I'm facing an issue where I'm unable to use an external *.jar file in a "Visual C++" Android project in Visual Studio 2017 Community Edition.

当我尝试编译时,它说软件包android.support.design.widget不存在.

When I try to compile it says the package android.support.design.widget does not exist.

这是我的设置:

复制步骤

  1. 确保已安装具有跨平台支持的Visual Studio 2017并打开它
  2. 选择文件"->新建"->项目..."->基本应用程序(Android Ant)"->确定

  1. 在项目中添加libs文件夹
  2. project.properties文件中添加jar.libs.dir=libs
  3. 将文件design-25.3.1-sources.jar从android-sdk文件夹(对我来说位于...\android-sdk\extras\android\m2repository\com\android\support\design\25.3.1下)复制到libs项目文件夹.如果引用会更好.我还没有找到办法.
  4. 将导入语句import android.support.design.widget.*;添加到生成的活动中.
  5. 点击F6(构建解决方案)
  1. Add a libs folder to the project
  2. In the project.properties file add jar.libs.dir=libs
  3. Copy the file design-25.3.1-sources.jar from the android-sdk folder (for me it was under ...\android-sdk\extras\android\m2repository\com\android\support\design\25.3.1) to the libs project folder. If referencing would work even better. I haven't found a way yet.
  4. Add the import statement import android.support.design.widget.*; into the generated Activity.
  5. Hit F6 (Build Solution)

导致所描述的错误.同样,Visual Studio 2015也有相同的问题-> Visual Studio 2015中Visual C ++开发中的依赖关系

Results in the error described. Also Visual Studio 2015 had the same problem -> Jar Dependencies in Visual C++ Development in Visual Studio 2015

我正在寻找一种使用外部库的方法.知道我可以改变什么吗?

I'm looking for a way to use external libraries. Any idea what I could change?

更新2017年7月10日

我最终不得不放弃并将构建系统从Ant更改为Gradle.使用Gradle,从Android SDK中添加库相对容易.这也是我决定结束问题的原因.

I finally had to give up and change the build system from Ant to Gradle. With Gradle it is relatively easy to add libraries from the Android SDK. This is also the reason why I rate to close my question.

推荐答案

我能解决的唯一方法是将构建系统从ANT切换到Gradle.

The only way I could solve it was by switching the build system from ANT to Gradle.

这篇关于Visual Studio 2017中的Visual C ++中的Jar依赖项(程序包不存在)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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