Android Studio Gradle在加载旧Gradle项目期间挂起 [英] Android Studio Gradle Hangs during loading old gradle project

查看:123
本文介绍了Android Studio Gradle在加载旧Gradle项目期间挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我在我的android studio遇到了一个问题。我在旧的lapi中使用了旧版本的Gradle。最近我买了一个新的lapi,并安装了最新版本的android studio,因此是最新的gradle。



现在我遇到了一个严重的问题。我无法将我以前的gradle构建项目加载到新的lapi中。当我尝试在我的新lapi中加载旧的gradle项目时。 Android工作室只是在打开旧项目时挂起。在这种情况下,只剩下选项是结束进程我的 Android Studio 。但是,当我开始创建新项目时,它工作正常,重新加载项目没有问题。



我真的很沮丧是什么导致了这一点。
我得出的结论是,我的旧项目使用旧的gradle,因此他们负责让我的android studio在加载启动时挂起。基本上,android工作室试图找到旧的gradle版本,如果无法找到它。它会自动尝试从互联网上下载。但这可能会消耗太多时间。

解决方案

以下是我如何解决问题而无需下载<$ c $的旧版本c> Gradle 。



我们有一个名为 MyOldApplication $ b $的旧项目b打开android studio并开始一个新项目(说 MyApplication )。



现在打开这个<$创建c $ c> MyApplication 项目。



MyApplication
build.gradle gradle.properties gradlew gradlew.bat local.properties



gradle



现在进入 MyOldApplication 并简单地替换这些文件。



现在访问项目文件 build.gradle (例如: app library ... etc)

,并简单地替换这些行

  compileSdkVersion 24 
buildToolsVersion24.1.0

targetSdkVersion 24

注意:将这些值替换为 MyApplication build.gradle文件(在MyApplication \app中找到)



现在只需在android studio中打开这个项目。



它会要求项目更新到最新的gradle(按OK)。

你完成了。


Recently, I came across a problem in my android studio. I was using older version of Gradle in my old lapi. And recently I bought a new lapi, and installed latest version of android studio, hence the latest gradle.

Now I came across a serious problem. I was not able to load my previous gradle build projects in my new lapi. When I tried to load my old gradle projects in my new lapi. Android studio just hangs during opening old projects. Only option left in that case was to End Process my Android Studio. Howsoever when I started to create new project it was working fine and reloading the project made no issue.

I was really frustrated what was causing this. I came to conclusion that my old projects were using old gradle hence they were responsible to make my android studio hangs during startup of loading them. Basically android studio was trying to find old gradle version if not able to find it. It will automatically try to download it from internet. But that may consume too much of time.

解决方案

Here's How I solved the issue without downloading the older version of Gradle.

Say, We have old project named MyOldApplication Open android studio and start a new project (Say MyApplication).

now open the directory where this MyApplication project is created.

Simple copy following files from MyApplication (build.gradle,gradle.properties,gradlew,gradlew.bat,local.properties)

And folder named gradle

Now go to the folder where MyOldApplication and simply replace these files.

Now visit every sub folder where project files build.gradle files resides.(Ex : app,library ... etc)

and simply replace these lines

compileSdkVersion 24
buildToolsVersion "24.1.0"

targetSdkVersion 24

NOTE: replace these values with the same as found in MyApplication build.gradle file (found inside MyApplication\app)

Now simply open this project in the android studio.

It will ask the project to update to latest gradle.(Press OK).

Yay!! You are done.

这篇关于Android Studio Gradle在加载旧Gradle项目期间挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆