Jar Dependencies (package does not exist) in Visual C++ in Visual Studio 2017

本小妞迷上赌 提交于 2019-12-25 09:46:51

问题


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.

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

Here is my setup:


Steps to reproduce

  1. Ensure you installed Visual Studio 2017 with Cross Platform Support and open it
  2. Choose "File"->"New"->"Project..."->"Basic Application (Android Ant)"->OK

  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)

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?

Update July 10th 2017

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.


回答1:


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



来源:https://stackoverflow.com/questions/44242443/jar-dependencies-package-does-not-exist-in-visual-c-in-visual-studio-2017

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!