Android Studio Error: “You must install the Android Support Repository though the SDK Manager”

匿名 (未验证) 提交于 2019-12-03 01:10:02

问题:

I just initialised a project on Android Studio, and it was working fine in version 0.2.6, but in 0.2.7, I get this error:

It creates a folder inside my Applications directory, but it does not initialize the project. Any help regarding this problem would be appreciated. I get no problems with version 0.1.1 through version 0.2.6, but when it comes to 0.2.7, things start to get problematic, like this and I can't even start a project.

回答1:

With 2.7 update I got the same issue. It looks like now Android Studio thinks sdk lays in under its own folder at android-studio/sdk.

You should be able to use android app under android-studio/sdk/tools to get missing components (not tested).

Another solution would be to fix sdk path (tested):

Close any projects then drop to Welcome to Android Studio Dialog

  1. Select Configure -> Project Defaults -> Project Structure
  2. Select SDKs -> Android SDK -> Android SDK Home Path
  3. Update it to your previous sdk location.


回答2:

you must manualy run SDK Manager
folder
android-studio/sdk/tools
search
android or android-sdk
new Support Repository must be already selected, and need only click "install" button



回答3:

got the same problem when applying the last patch (2.7). I've resolved it by copying SDK Manager.exe from android-studio\sdk\tools\lib to android-studio\sdk\ then I've launched it and install the missing component.

After restarting Android Studio it works again !



回答4:

to solve this problem I used this link: Downloading the Support Libraries



回答5:

Just as Leonidos said, install ASR through SDK Manager:

Tools > Android > SDK Manager ; Navigate to the Extras folder, and select Android Support Repositories.

Click install packages and it will work fine



回答6:

I did a fresh install of Java, SDK and Android Studio, update it to 0.2.7 and install the ASR through SDK Manager, but the messages comes again.

So i found this solution.

The most common problem for Android Studio and 64Bit Windows System is the no 8.3 short path for C:\Program Files and C:\Program Files (x86).

find_java.exe 

couldn't handle it and give a wrong path back.

Finally do this:

dir /x C:  

-- It shows no 8.3 short paths.

 fsutil 8dot3name query C: 

-- It shows NtfsDisable8dot3NameCreation is 1 on "C:", means 8.3 short path won't be created in "C:".

Then I enable the generation of 8.3 short name by:

fsutil 8dot3name set C: 0 

and create short names for C:\Program Files and C:\Program Files (x86) in windows recovery mode by:

fsutil file setshortname "C:\Program Files" PROGRA~1  fsutil file setshortname "C:\Program Files (x86)" PROGRA~2 

And now dir /x C: can show the short names.

And now find_java.exe -s

can show the short path C:\PROGRA~1\Java\JDK17~1.0_2\bin\java.exe.

And now find_java.bat and android.bat can work good now!

source

Also copying SDK Manager.exe from android-studio\sdk\tools\lib to android-studio\sdk\



回答7:

Just a few ideas to try that should hopefully help. These can be found by using Ctrl + Shift + A.

"Sync project with Gradle" - (it's also often in the toolbar with a green and yellow ball and a blue down arrow next to three android icons)

"Gradle" and select the ToolBox option; then hit the blue refresh icon to refresh all the gradle projects

"Project Structure..." (also available under File) Under the Libraries project settings you should see a valid reference to your support library. You'll also want to skim through everything to make sure everything else looks good with the project.

"Invalidate Caches..." (another available under File) Invalidate and restart. This one got me going again after the previous upgrade generated a bunch of errors.

Some of these may be redundant, but after having fought with similar issues in the past it's just a few easy things I've found to check.

If refreshing everything doesn't work you can always pull up the Android SDK from Tools -> Android -> SDK or from the toolbar with the blue/green boxy android that has a black down arrow. It should be next to the Sync Gradle button.



回答8:

I update the Android Studio(AS) and see the same issue.

However, there is something slightly different about what I find out.

I actually have two sdks because I shift from Eclipse to AS.

Hence, I get one sdk in

c:\Program Files(x86)\Android\android-sdk

and anther in

c:\Android\android-studio\sdk.

And the real one that I use is in c:\Program Files(x86)\Android\android-sdk.

The important thing is that, I find that only one of the sdk setting is changed after the update.

Quick Start > Configure > Project Defaults > Project Structure  > Platform Settings > SDKs   1.7         JDK home path:          C:\Program Files\Java\jdk1.7.0_10  Android 2.2 Platform          Android SDK home path:          C:\Program Files(x86)\Android\android-sdk  Android 4.0.3 Platform          same as 2.2  Android 4.2.2 Platform          Android SDK home path:          C:\Android\android-studio\sdk    

After fixing the path in 4.2.2, I could create new project successfully again.



回答9:

For some reason, if you install Android Studio in the same directory as the SDK, this error will pop up. Just install it somewhere else. For instance, I had it installed at C:\Android\, along with the SDK. Then, I decided to install it at C:\Program Files (x86)\Android Studio and it simply worked.



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