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
- Ensure you installed Visual Studio 2017 with Cross Platform Support and open it
- Choose "File"->"New"->"Project..."->"Basic Application (Android Ant)"->OK
- Add a
libs
folder to the project - In the
project.properties
file addjar.libs.dir=libs
- 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 thelibs
project folder. If referencing would work even better. I haven't found a way yet. - Add the import statement
import android.support.design.widget.*;
into the generated Activity. - 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.