英文:
How to import an ancient Android project with NO GRADLE WHATSOEVER into today's Android Studio?
问题
以下是您要翻译的内容:
"At first glance, you might think that this question has been answered a few times on line. However, every article I found here and elsewhere had to do with importing an old Android project into today's Android Studio where one or more gradle config files already exist in one or more places in the project's code tree.
In my case, however, I have a 9-year-old Android project that I want to work on within today's Android studio, and my project contains no gradle-related files whatsoever !!!
I believe I used either IntelliJ or Eclipse to build this project back when I was originally working on it in 2014.
Is there any way to import an old Android project which is totally devoid of anything to do with gradle into today's Android Studio and then successfully build it for a modern version of Android (Android 11 or later)?
I realize that I'll probably have to make some code changes in order to get the old (kitkat-based) code to run properly under Android 11 or later. I'm not asking about such code changes. What I simply want to know is how to get today's Android Studio to successfully import my ancient project. Then I will be able to make the necessary code changes.
Please forgive me if my online searches have overlooked an answer to this question. If so, a pointer to such an answer would be greatly appreciated.
Thank you in advance for any help and suggestions."
以下是翻译好的内容:
乍一看,您可能会认为这个问题在网上已经回答了几次。然而,我在这里和其他地方找到的每篇文章都涉及将旧的Android项目导入今天的Android Studio,其中一个或多个gradle配置文件已经存在于项目代码树的一个或多个位置。
然而,在我的情况下,我有一个9年前的Android项目,我想在今天的Android Studio中工作,我的项目中根本没有与gradle有关的文件!
我相信我当初在2014年工作时,使用了IntelliJ或Eclipse构建了这个项目。
有没有办法将一个与gradle完全无关的旧Android项目导入今天的Android Studio,然后成功构建它以适用于现代版本的Android(Android 11或更高版本)?
我意识到我可能需要对代码进行一些更改,以确保旧的(基于kitkat的)代码在Android 11或更高版本下正常运行。我不是在询问这些代码更改。我只是想知道如何让今天的Android Studio成功导入我的古老项目。然后我将能够进行必要的代码更改。
如果我的在线搜索忽视了这个问题的答案,请原谅我。如果有的话,指向这样一个答案将不胜感激。
在此提前感谢任何帮助和建议。
英文:
At first glance, you might think that this question has been answered a few times on line. However, every article I found here and elsewhere had to do with importing an old Android project into today's Android Studio where one or more gradle config files already exist in one or more places in the project's code tree.
In my case, however, I have a 9-year-old Android project that I want to work on within today's Android studio, and my project contains no gradle-related files whatsoever !!!
I believe I used either IntelliJ or Eclipse to build this project back when I was originally working on it in 2014.
Is there any way to import an old Android project which is totally devoid of anything to do with gradle into today's Android Studio and then successfully build it for a modern version of Android (Android 11 or later)?
I realize that I'll probably have to make some code changes in order to get the old (kitkat-based) code to run properly under Android 11 or later. I'm not asking about such code changes. What I simply want to know is how to get today's Android Studio to successfully import my ancient project. Then I will be able to make the necessary code changes.
Please forgive me if my online searches have overlooked an answer to this question. If so, a pointer to such an answer would be greatly appreciated.
Thank you in advance for any help and suggestions.
Here is a listing of all the files and directories in my project ...
AndroidManifest.xml
project.properties
bin/
bin/AndroidManifest.xml
bin/classes
bin/classes/us
bin/classes/us/potam
bin/classes/us/potam/hippo
bin/classes/us/potam/hippo/experimental
bin/res
src/
src/us
src/us/potam
src/us/potam/hippo
src/us/potam/hippo/experimental
src/us/potam/hippo/experimental/ThirdPartyBase64.java
src/us/potam/hippo/experimental/ExperimentalSMSDBHelper.java
src/us/potam/hippo/experimental/ExperimentalSMSBootReceiver.java
src/us/potam/hippo/experimental/ExperimentalSMSMessage.java
src/us/potam/hippo/experimental/ExperimentalSMSHandler.java
src/us/potam/hippo/experimental/ExperimentalSMSObserver.java
src/us/potam/hippo/experimental/ExperimentalSMSService.java
src/us/potam/hippo/experimental/ExperimentalSMSDataSource.java
src/us/potam/hippo/experimental/ExperimentalSMSMainActivity.java
src/us/potam/hippo/experimental/ExperimentalUtils.java
libs/
proguard-project.txt
gen/
gen/us
gen/us/potam
gen/us/potam/hippo
gen/us/potam/hippo/experimental
gen/us/potam/hippo/experimental/BuildConfig.java
gen/us/potam/hippo/experimental/R.java
out/
out/production
out/production/ExperimentalSMSTrigger
out/production/ExperimentalSMSTrigger/us
out/production/ExperimentalSMSTrigger/us/potam
out/production/ExperimentalSMSTrigger/us/potam/hippo
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/BuildConfig.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/ThirdPartyBase64.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/ExperimentalSMSService.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/R$drawable.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/ExperimentalSMSMainActivity$1.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/ExperimentalUtils.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/ExperimentalSMSDBHelper.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/ThirdPartyBase64$1.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/R$layout.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/ExperimentalSMSBootReceiver.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/R$dimen.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/ExperimentalSMSMainActivity.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/R$id.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/ExperimentalSMSHandler.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/ThirdPartyBase64$OutputStream.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/ExperimentalSMSHandler$1.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/R.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/ExperimentalSMSMessage.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/R$attr.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/ExperimentalSMSDataSource.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/R$string.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/ExperimentalSMSObserver.class
out/production/ExperimentalSMSTrigger/us/potam/hippo/experimental/ThirdPartyBase64$InputStream.class
.idea/
.idea/workspace.xml
.idea/misc.xml
.idea/runConfigurations
.idea/runConfigurations/ExperimentalSMS.xml
.idea/.gitignore
.idea/modules.xml
.classpath
res/
res/values-v14
res/layout
res/layout/main_activity_screen.xml
res/values-v11
res/drawable-hdpi
res/drawable-hdpi/experimental.png
res/drawable
res/drawable/experimental.png
res/drawable-xhdpi
res/drawable-xhdpi/experimental.png
res/values
res/values/dimens.xml
res/values/strings.xml
res/drawable-xxhdpi
res/drawable-xxhdpi/experimental.png
res/drawable-mdpi
res/drawable-mdpi/experimental.png
res/values-w820dp
res/values-w820dp/dimens.xml
res/drawable-ldpi
res/drawable-ldpi/experimental.png
.project
.settings/
.settings/org.eclipse.jdt.core.prefs
ExperimentalSMSTrigger.iml
assets/
答案1
得分: 1
我按照@Morrison-Chang和@Doron-Ben-Ari的建议,今天在Android Studio中加载并运行了旧项目!以下是我做的事情:
- 在Android Studio中创建了一个与旧项目同名的空项目:
ExperimentalSMSTrigger
,并指定了我在旧项目中使用的包名称。 - 将旧项目中的所有
*.java
文件,包括ExperimentalSMSMainActivity.java
,复制到新项目中MainActivity.java
所在的相同目录。 - 删除了新项目中的
MainActivity.java
文件。 - 用旧项目中相应的项目替换了新项目中的
res
和AndroidManifest.xml
项。 - 将新项目中对
MainActivity
的所有引用更改为ExperimentalSMSMainActivity
。
然后进行了“构建”和“运行”,它正常工作!
原来我不必对gradle做任何事情。
现在,我只需编写一些功能增强功能,最终的应用程序将能够在Android 11或更高版本上运行。
再次感谢你们两位的帮助!
英文:
I followed the advice of @Morrison-Chang and @Doron-Ben-Ari, and I got the old project loaded and running within today's Android Studio!
Here's all I ended up doing ...
- I created an empty project in Android Studio with the same name as my old project:
ExperimentalSMSTrigger
, and I specified the package name that I use in my old project. - I copied all of the
*.java
files from the old project -- includingExperimentalSMSMainActivity.java
-- into the same directory whereMainActivity.java
is resident in the new project. - I deleted the
MainActivity.java
file in the new project. - I replaced the
res
andAndroidManifest.xml
items in the new project with the corresponding items in the old project. - I changed the names of all references to
MainActivity
in the new project toExperimentalSMSMainActivity
.
I then did a "build" and a "run", and it's working!
It turns out that I didn't have to do anything with gradle.
Now, I just have some feature enhancements to write, and the resulting app will be able to run under Android 11 or later Android versions.
Thank you again to both of you for your help!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论