简体   繁体   English

升级了 Android Studio……现在当我尝试运行我的应用程序时,我的主要活动出现“未找到实现”

[英]Upgraded Android Studio… now when I try to run my apps, I get “No implementation found” for my main activity

Upgraded Android studio (stupid, right?).升级了 Android 工作室(愚蠢,对吧?)。 Now not only can I not hit alt-E, C to do a copy, but some older apps of mine, that I need to support, no longer run.现在我不仅不能按 alt-E、C 进行复制,而且我需要支持的一些较旧的应用程序不再运行。 These are apps that were put together with Android Studio 1.x.这些是与 Android Studio 1.x 放在一起的应用程序。

First off, when I tried to compile, it demanded that I put "-keepattributes InnerClasses" in my proguard rules.首先,当我尝试编译时,它要求我将“-keepattributes InnerClasses”放入我的 proguard 规则中。 Just including that in case it's some kind of hint.只是包括它,以防万一它是某种暗示。

The program compiles fine, but then it runs and quits instantly.该程序编译得很好,但它会立即运行并退出。 Looking at Logcat, I see this:看着 Logcat,我看到了这个:

2021-03-18 22:02:34.960 6147-6147/com.mycompany.myapp E/ycompany.myapp: No implementation found for java.lang.String com.mycompany.myapp.myappActivity.d() (tried Java_com_mycompany_myapp_myappActivity_d and Java_com_mycompany_myapp_myappActivity_d__)

Here's the weird part, though... in myactivity onCreate, I output a line of text.不过,这是奇怪的部分……在 myactivity onCreate 中,我 output 一行文本。 It gets there.它到达那里。 That happens.那个会发生。 It prints out ">>>>>CREATED APP<<<<<"它打印出 >>>>>>创建的应用程序<<<<<"

Can anyone explain what's happening?谁能解释发生了什么? What do I need to do to fix this???我需要做什么来解决这个问题???

A lot has changed since ASs 1.x especially with the gradle / android gradle plugin.自 ASs 1.x 以来发生了很多变化,尤其是使用 gradle / android gradle 插件。 These are very finicky even after minor updates.即使在小更新之后,这些也非常挑剔。 Nevertheless you're more or less forced to update to a newer (not necessarily the newest) IDE version.尽管如此,您或多或少还是被迫更新到更新的(不一定是最新的)IDE 版本。 Not finding java.lang.String suggests some major incompatibility issue.未找到 java.lang.String 表明存在一些重大的不兼容问题。

First you should check your JDK version (and ensure you have the full kit not just a JRE).首先,您应该检查您的 JDK 版本(并确保您拥有完整的工具包,而不仅仅是 JRE)。 Not all IDE versions work with all JDKs and again use an older one (10, 12), not the absolute bleeding edge as the newest might not be supported (and android does not support newer java features anyway).并非所有 IDE 版本都适用于所有 JDK,并再次使用较旧的版本(10、12),而不是绝对前沿,因为可能不支持最新版本(并且 android 无论如何都不支持较新的 Z93F725A07423FE1C886ZD4 功能)。 I use JDK 12 and Ass 3.6.1.我使用 JDK 12 和 Ass 3.6.1。 Also check the gradle version you're using since gradle also has its incompatibilities.还要检查您使用的 gradle 版本,因为 gradle 也有其不兼容性。 Remember to also inspect the contents of JAVA_HOME and GRADLE_HOME environment variables (if they exist and are used by your project) since they may override the build tool versions that are used.请记住还要检查 JAVA_HOME 和 GRADLE_HOME 环境变量的内容(如果它们存在并且被您的项目使用),因为它们可能会覆盖所使用的构建工具版本。

Your safest bet would be to create a new empty project and copy all your sources in it.您最安全的选择是创建一个新的空项目并将所有源代码复制到其中。 That might take less time then trying to clean the existing project, migrate the plugins, gradle and so on.这可能比尝试清理现有项目、迁移插件、gradle 等花费更少的时间。

Until you fix the project setup you can disable proguard to get rid of one more hassle by setting minifyEnabled false in your app/ build.gradle # buildTypes # release.在您修复项目设置之前,您可以通过在您的应用程序/ build.gradle # buildTypes # release 中设置minifyEnabled false来禁用 proguard 以摆脱更多麻烦。 Note that proguard is usually disabled for debug builds.请注意,对于调试版本,通常禁用 proguard。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我尝试在Android Studio上运行我的Android程序时出现NullPointerException - NullPointerException when I try to run my Android Program on Android Studio 尝试获取电话号码时,为什么我的活动崩溃了? - Why does my activity crash when I try to get a number? 我不小心在 Android Studio 中创建了一个空白 Activity,然后将其删除。 现在我无法安装我的 - I accidentally created a Blank Activity in Android Studio, and deleted it afterwards. Now I can't install my 在android中,当我尝试运行我的项目时失败了吗? - In android when i try to run my project it fails? 当我旋转相机应用程序中的屏幕并且我的主要活动失败时,Android Camera无法将照片返回主要活动 - Android Camera not returning photo to main activity when I rotate the screen in the camera application and my main activity fails 我已升级到 gradle 7.2,现在我的项目遇到了错误 - I have upgraded to gradle 7.2, Now my project is caughting an error 为什么我可以在自己的笔记本电脑中运行自己的android应用程序,而这些应用程序已在使用Android Studio的学校实验室中成功运行 - Why i can run my android apps in my own laptop that are successfully run in my school lab with android studio 我将我的 android 工作室更新到最新版本,但它现在没有启动,并且出现内部错误 - I updated my android studio to the newest version and it doesn't start now and I get an internal errors 当我尝试访问捆绑软件中的信息时,为什么我的Android活动被强制关闭? - Why does my Android activity force close when I try to access info I put in the bundle? Android Studio:运行我的应用程序时出现很多错误 - Android Studio: lots of errors when I run my app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM