我从哪里导入以前版本的 Android Studio 的设置?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24458923/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
From where do I import settings from previous version of Android Studio?
提问by B. Clay Shannon
I was running Droidio (Android Studio) 0.6.1; from there I was not able to update to the newest version (a quantum leap to 0.8); I had to download it separately and install from Windows Explorer. But now the installation process is looking for old settings:
我正在运行 Droidio (Android Studio) 0.6.1;从那里我无法更新到最新版本(飞跃到 0.8);我必须单独下载并从 Windows 资源管理器安装。但现在安装过程正在寻找旧设置:
Where it seems to want to take me is here (to the Android folder, I reckon); this is what I see when I mash the "compressed ellipsis" (one dot) button:
它似乎想带我去的地方就在这里(我认为是 Android 文件夹);这是我在混搭“压缩省略号”(一个点)按钮时看到的内容:
...but I'm not sure that is really the right spot; Is it [not]? What is the precise name of the settings file I should be seeking?
...但我不确定那是不是正确的位置;是【不是】吗?我应该寻找的设置文件的确切名称是什么?
UPDATE
更新
I followed Gabriele's directive, and then I got this:
我遵循了 Gabriele 的指令,然后我得到了这个:
I chose "Use Android Studio's SDK"
我选择了“使用 Android Studio 的 SDK”
And then I got this when trying to rebuild my project, "Error:Execution failed for task ':app:preBuild'. failed to find target android-19 : C:\Users\clay\AppData\Local\Android\android-studio1\sdk"
然后我在尝试重建我的项目时得到了这个,“错误:任务 ':app:preBuild' 执行失败。未能找到目标 android-19 : C:\Users\clay\AppData\Local\Android\android-studio1 \sdk"
UPDATE 2
更新 2
I then opened the SDK Manager and installed what was missing/out of date, and tried to build again.
然后我打开了 SDK 管理器并安装了丢失/过时的内容,并尝试再次构建。
I got the error, "Failed to refresh Gradle project 'Platypus' Error: Cause: failed to find target android-19: C:\users\clay\AppData\Local\Android\android-studio1\sdk Install missing platform and sync project
我收到错误消息,“无法刷新 Gradle 项目‘鸭嘴兽’错误:原因:未能找到目标 android-19:C:\users\clay\AppData\Local\Android\android-studio1\sdk 安装缺少的平台和同步项目
The "Install missing platform and sync project" part of the message is a link. I clicked it, accepted the License Agreement.
消息的“安装缺少的平台和同步项目”部分是一个链接。我点击了它,接受了许可协议。
Once that finished, the build failed again with a similar message: "...failed to find Build Tools revision 19.1.0 Install Build Tools 19.1.0 and sync project"
完成后,构建再次失败并显示类似消息:“ ...无法找到构建工具修订版 19.1.0 安装构建工具 19.1.0 并同步项目”
Again, the "install..." jazz was a link; I clicked it, accepted, and installed...
再次,“安装...”爵士乐是一个链接;我点击它,接受并安装...
The next problem child was, "Error:The project is using an unsupported version of the Android Gradle plug-in (0.11.2) Fix plug-in version and re-import project"
下一个问题是,“错误:项目使用了不受支持的 Android Gradle 插件版本 (0.11.2) 修复插件版本并重新导入项目”
Acquiescing to the counsel of the wise old man in "Never Cry Wolf," I endeavored to persevere by clicking "Fix plug-in version and re-import project"
默许了《狼来了》中智者的劝告,我努力坚持,点了“修复插件版本,重新导入项目”
At which point I finally got a successful build.
在这一点上,我终于得到了一个成功的构建。
UPDATE 3
更新 3
I then ran the project, and it seemed to be running (it said so, and the red square was visible), but no emulator ever appeared.
然后我运行了该项目,它似乎正在运行(它是这样说的,并且可以看到红色方块),但是没有出现模拟器。
I opened the AVD Manager, and the device had a warning icon (repairable). I clicked the "Repair" button; it seemed to work - the warning icon disappeared.
我打开了 AVD 管理器,设备有一个警告图标(可修复)。我点击了“修复”按钮;它似乎有效 - 警告图标消失了。
But then I got this:
但后来我得到了这个:
It still won't display an emulator when I Run > Debug App...
当我运行 > 调试应用程序时,它仍然不会显示模拟器...
It used to be (with Droidio 0.5* to 0.61) that the first time I ran, I would see this:
曾经(使用 Droidio 0.5* 到 0.61)我第一次运行时,我会看到:
...and the Emulator would eventually come up; subsequent runs of the app, the Device would be listed at the top (under "Choose a Running Device") - no more, though - it is only at the bottom as shown in the scream shot above, even on subsequent runs of the app...
...模拟器最终会出现;应用程序的后续运行,设备将列在顶部(在“选择正在运行的设备”下) - 但不会更多 - 它仅在底部,如上面的尖叫声所示,即使在应用程序的后续运行中也是如此...
I reckon I should try "re-creating the AVD's weird, malformed config.ini" but don't savvy just what steps to take to accomplish that.
我认为我应该尝试“重新创建 AVD 的奇怪的、格式错误的 config.ini”,但不要知道要采取什么步骤来实现这一点。
采纳答案by Hamed MP
I used a method to trick the Android Studio to import settings from previous one without exporting the settings and it worked.
我使用了一种方法来欺骗 Android Studio 从前一个导入设置而不导出设置并且它起作用了。
Just go to your previous .AndroidStudio\config
folder, copy and paste them all to the new one (in my scenario I updated from 1.1 to 1.2 beta) .AndroidStudioPreview1.2
只需转到上一个.AndroidStudio\config
文件夹,将它们全部复制并粘贴到新文件夹中(在我的场景中,我从 1.1 更新到 1.2 测试版).AndroidStudioPreview1.2
(For preventing any failure, please make a Rar file of your original config, also, after it works, export it so you can import it if you need it)
(为了防止出现任何故障,请为您的原始配置制作一个 Rar 文件,并且在它运行后,将其导出,以便您在需要时可以导入它)
回答by Gabriele Mariotti
UPDATED 16/05/2020
2020 年 5 月 16 日更新
If you are using AndroidStudio 2.1-4.1you will find these folders:
如果您使用的是AndroidStudio 2.1-4.1,您将找到以下文件夹:
- in Windowsshould be in
c:\user\yourname\.AndroidStudioX.Y
- in Linuxshould be in
/home/yourname/.AndroidStudioX.Y
- in Macshould be in
~/Library/Preferences/.AndroidStudioX.Y
- 在Windows 中应该在
c:\user\yourname\.AndroidStudioX.Y
- 在Linux 中应该在
/home/yourname/.AndroidStudioX.Y
- 在Mac 中应该在
~/Library/Preferences/.AndroidStudioX.Y
If you are using AndroidStudio 2.0you will find these folders:
如果您使用的是AndroidStudio 2.0,您将找到以下文件夹:
- in Windowsshould be in
c:\user\yourname\.AndroidStudio2.0
- in Linuxshould be in
/home/yourname/.AndroidStudio2.0
- in Macshould be in
~/Library/Preferences/.AndroidStudio2.0
- 在Windows 中应该在
c:\user\yourname\.AndroidStudio2.0
- 在Linux 中应该在
/home/yourname/.AndroidStudio2.0
- 在Mac 中应该在
~/Library/Preferences/.AndroidStudio2.0
If you are using AndroidStudio 1.5you will find these folders:
如果您使用的是AndroidStudio 1.5,您将找到以下文件夹:
- in Windowsshould be in
c:\user\yourname\.AndroidStudio1.5
- in Linuxshould be in
/home/yourname/.AndroidStudio1.5
- in Macshould be in
~/Library/Preferences/.AndroidStudio1.5
- 在Windows 中应该在
c:\user\yourname\.AndroidStudio1.5
- 在Linux 中应该在
/home/yourname/.AndroidStudio1.5
- 在Mac 中应该在
~/Library/Preferences/.AndroidStudio1.5
If you are using .AndroidStudioPreview 1.4you will find these folders:
如果您使用的是.AndroidStudioPreview 1.4,您将找到以下文件夹:
- in Windowsshould be in
c:\user\yourname\.AndroidStudioPreview1.4
- in Linuxshould be in
/home/yourname/.AndroidStudioPreview1.4
- in Macshould be in
~/Library/Preferences/.AndroidStudioPreview1.4
- 在Windows 中应该在
c:\user\yourname\.AndroidStudioPreview1.4
- 在Linux 中应该在
/home/yourname/.AndroidStudioPreview1.4
- 在Mac 中应该在
~/Library/Preferences/.AndroidStudioPreview1.4
If you are using AndroidStudio 1.3you will find these folders:
如果您使用的是AndroidStudio 1.3,您将找到以下文件夹:
- in Windowsshould be in
c:\user\yourname\.AndroidStudio1.3
- in Linuxshould be in
/home/yourname/.AndroidStudio1.3
- in Macshould be in
~/Library/Preferences/.AndroidStudio1.3
- 在Windows 中应该在
c:\user\yourname\.AndroidStudio1.3
- 在Linux 中应该在
/home/yourname/.AndroidStudio1.3
- 在Mac 中应该在
~/Library/Preferences/.AndroidStudio1.3
Your setting (with a Previewversion):
您的设置(带有预览版):
- in Windowsshould be in
c:\user\yourname\.AndroidStudioPreview
- in Linuxshould be in
/home/yourname/.AndroidStudioPreview
- in Macshould be in
~/Library/Preferences/AndroidStudioPreview
- 在Windows 中应该在
c:\user\yourname\.AndroidStudioPreview
- 在Linux 中应该在
/home/yourname/.AndroidStudioPreview
- 在Mac 中应该在
~/Library/Preferences/AndroidStudioPreview
回答by domi
Starting with Android Studio 0.8.0(Beta) its now
从Android Studio 0.8.0(Beta) 开始
/home/{username}/.AndroidStudioBeta
for a *nix environment
对于 *nix 环境
UPDATE:
更新:
Since Android Studiois now out of beta the settings can now be found in:
由于Android Studio现已退出测试版,因此现在可以在以下位置找到设置:
/home/{username}/.AndroidStudio
回答by Andrii Kovalchuk
On mac Sierra, Android studio 2.3
在 Mac Sierra 上,Android studio 2.3
/Users/[username]/Library/Preferences/AndroidStudio2.3/
回答by Steve Ingram
On my Mac, using Android Studio 2.1, the directory is
在我的 Mac 上,使用 Android Studio 2.1,目录是
~/Library/Preferences/AndroidStudio2.1/
~/Library/Preferences/AndroidStudio2.1/
that is, not a hidden dir.
也就是说,不是隐藏目录。
回答by Henry
I had a similar problem like this. I found a different solution for it. https://stackoverflow.com/a/33021782/4747587
我有一个类似的问题。我找到了一个不同的解决方案。https://stackoverflow.com/a/33021782/4747587
回答by donden1
And in a *nix environment, this will probably be located at /home/[username]/.AndroidStudioPreview
在 *nix 环境中,这可能位于 /home/[username]/.AndroidStudioPreview