Cocos2d-x 3.15 Android Studio and Visual Studio 2017 problems

Hello, I am facing two problems.

1st: Android Studio 2.3.1
Looks like cocos2d directory is not linked properly. But I don’t know how to fix it.

2nd: Visual studio 2017
When I open proj.win10 I get these errors.

C:\Users\Mykolas\Documents\Cocos2d-x\JoeRider\cocos2d\external\Box2D\proj-win10\libbox2d.vcxproj : error : Unable to read the project file “libbox2d.vcxproj”.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(1975,3): The imported project “C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.Cpp.targets” was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

C:\Users\Mykolas\Documents\Cocos2d-x\JoeRider\cocos2d\cocos\editor-support\spine\proj.win10\libSpine.vcxproj : error  : Unable to read the project file "libSpine.vcxproj".
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(1975,3): The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.Cpp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

C:\Users\Mykolas\Documents\Cocos2d-x\JoeRider\cocos2d\cocos\2d\libcocos2d_win10\libcocos2d.vcxproj : error  : Unable to read the project file "libcocos2d.vcxproj".
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(1975,3): The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.Cpp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

C:\Users\Mykolas\Documents\Cocos2d-x\JoeRider\proj.win10\App\JoeRider.vcxproj : error  : Unable to read the project file "JoeRider.vcxproj".
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(1975,3): The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.Cpp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

C:\Users\Mykolas\Documents\Cocos2d-x\JoeRider\cocos2d\external\bullet\proj.win10\libbullet.vcxproj : error  : Unable to read the project file "libbullet.vcxproj".
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(1975,3): The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.Cpp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

C:\Users\Mykolas\Documents\Cocos2d-x\JoeRider\cocos2d\external\recast\proj.win10\librecast.vcxproj : error  : Unable to read the project file "librecast.vcxproj".
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(1975,3): The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.Cpp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Any ideas?

I get the same problem in android studio. Though it will build and debug on this version which is a step forward for me… sorry I can’t be more help. If I solve this I will post back.

I think I solved it. What version of android NDK do you use? It does not work with the latest one for me. Try download previous version (r13b). NDK r13b
Don’t forget to change NDK location in Android Studio:
file -> Project Structure -> “Android NDK location”.

I tried that, updated the environment vars + rebooted as well but it’s still “Red” ?

Downgrading NDK helped for me. But I don’t know how to solve your issue. I recommend you to read this thread. You might find something useful.

Thanks, I just got it working. Though I’m not convinced it’s right. Do you set “ANDROID_NDK_HOME” and “NDK_ROOT” as environment variables?

You can easily change it.

  1. Press windows button and go to run.
  2. In there, type environment variables.
  3. Inside there in the first part, there should be user environment variables.
  4. Check for NDK_ROOT, it should be there.
  5. Click on edit, and change the path to the new one.
    This will change your NDK_ROOT environment variable.
    Now, run setup.py again, it will show you the updated NDK_ROOT.

My question is are they the same as the directory you select when you do “File” -> “Project Structure” and set “Android NDK Location” ?

I am not sure. I guess that “Android NDK Location” is used when build project with android studio and “NDK_ROOT” is used by console build. But it’s just my guess :smiley:

Hi, did you solve the issue with Visual Studio 2017 eventually?
I’m in the same situation with the same error:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(1975,3): The imported project “C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.Cpp.targets” was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

when opening proj.win10