HarmonyOS 鸿蒙Next 升级DevEco Studio 3.0 Beta2后开发一半的APP项目无法模拟显示,界面闪退

HarmonyOS 鸿蒙Next 升级DevEco Studio 3.0 Beta2后开发一半的APP项目无法模拟显示,界面闪退

这是提示:

Configure project :entry

Configuration ‘compile’ is obsolete and has been replaced with new configuration ‘implementation’.It will be removed in ‘version 2.5.0.0’ of the Ohos Gradle Plugin

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use ‘–warning-mode all’ to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 25s

好像是:build.gradle(.entry) 被改了,被改后的我贴在下面,请高手指点

apply plugin: 'com.huawei.ohos.hap'
apply plugin: 'com.huawei.ohos.decctest'
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
ohos {
    compileSdkVersion 7
    defaultConfig {
        compatibleSdkVersion 5
    }
    buildTypes {
        release {
            proguardOpt {
                proguardEnabled false
                rulesFiles 'proguard-rules.pro'
            }
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
    testImplementation 'junit:junit:4.13.1'
    compile 'com.google.code.gson:gson:2.6.2'
    implementation group: 'com.squareup.okhttp3',name: 'okhttp',version: '4.6.0'
    ohosTestImplementation 'com.huawei.ohos.testkit:runner:2.0.0.200'
}

更多关于HarmonyOS 鸿蒙Next 升级DevEco Studio 3.0 Beta2后开发一半的APP项目无法模拟显示,界面闪退的实战教程也可以访问 https://www.itying.com/category-93-b0.html

10 回复

开发者您好,闪退问题还是要看具体报错是什么,这个ConfirmDialog应该是自定义的组件,看下这个组件是否有问题。

更多关于HarmonyOS 鸿蒙Next 升级DevEco Studio 3.0 Beta2后开发一半的APP项目无法模拟显示,界面闪退的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


我补充一下完整的编译提示:

Executing tasks: [:entry:assembleDebug] in project E:\FCNDView\HarmonyOS\AppCoalMine

> Task :entry:preBuild

> Task :entry:mergeDebugJavaResource UP-TO-DATE

> Task :entry:compileDebugIdl NO-SOURCE

> Task :entry:preDebugBuild

> Task :entry:mergeDebugResources UP-TO-DATE

> Task :entry:mergeDebugProfile UP-TO-DATE

> Task :entry:processDebugProfile UP-TO-DATE

> Task :entry:compileDebugResources UP-TO-DATE

> Task :entry:compileDebugRFile UP-TO-DATE

> Task :entry:generateDebugBuildConfig UP-TO-DATE

> Task :entry:packageDebugRClass UP-TO-DATE

> Task :entry:compileDebugJavaWithJavac UP-TO-DATE

> Task :entry:generateDebugJsManifest NO-SOURCE

> Task :entry:compileDebugEtsWithNode NO-SOURCE

> Task :entry:compileDebugJsWithNode NO-SOURCE

> Task :entry:processDebugJavaRes UP-TO-DATE

> Task :entry:processDebugLibsFile UP-TO-DATE

> Task :entry:generateDebugShell UP-TO-DATE

> Task :entry:compileDebugShellResources UP-TO-DATE

> Task :entry:processDebugShellManifest UP-TO-DATE

> Task :entry:linkDebugShellResources UP-TO-DATE

> Task :entry:compileDebugShellJavaWithJavac UP-TO-DATE

> Task :entry:transformDebugShellClasses UP-TO-DATE

> Task :entry:packageDebugShell UP-TO-DATE

> Task :entry:packageDebugSimplifyShell UP-TO-DATE

> Task :entry:validateDebugSigning

> Task :entry:signDebugShell UP-TO-DATE

> Task :entry:replaceDebugLegacy

> Task :entry:verifyDebugClasses

> Task :entry:transformDebugClasses UP-TO-DATE

> Task :entry:packageDebugHap UP-TO-DATE

> Task :entry:signDebugHap UP-TO-DATE

> Task :entry:assembleDebug

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use ‘–warning-mode all’ to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 1m 11s

29 actionable tasks: 6 executed, 23 up-to-date

Build Analyzer results available

模拟器本身就非常占用内存,若是内存小的话就不要开了,没有真机就用远程模拟器吧

进一步找问题:首先依赖中的问题已经解决:更新了这么一条:

implementation "com.google.code.gson:gson:2.8.2"

闪退的问题也找到了但是还不知道如何解决,原因是我在代码中做了个Dialog对话框,引入到这段代码后就闪退了,这段代码如:

ConfirmDialog confirmDialog = new ConfirmDialog(getContext());
confirmDialog.setOnDialogClickListener(new ConfirmDialog.OnDialogClickListener() {
    @Override
    public void onOKClick() {

    }

    @Override
    public void onCancelClick() {

    }
});

我的模拟器开上半天后,电脑内存占用直线飙升,最后直接崩溃。感觉模拟器有类似内存泄露的问题。

我的不会啊,

你的电脑是多大内存,

是不是内存不够啊,

.some-class { color: dark;}

开发者您好,相关问题已经反馈给工作人员,稍后会再回复您,感谢您对华为开发者论坛的支持。

针对HarmonyOS 鸿蒙Next升级DevEco Studio 3.0 Beta2后开发一半的APP项目无法模拟显示、界面闪退的问题,可能的原因及解决方案如下:

  1. 兼容性问题:DevEco Studio 3.0 Beta2可能引入了与旧版本不兼容的更改。检查项目的build.gradle文件,确保所有依赖项都与新版本兼容,特别是与HarmonyOS SDK相关的依赖。

  2. 配置更新:升级IDE后,可能需要更新项目的配置文件以匹配新版本的要求。检查config.json和其他配置文件,确保它们符合当前版本的规范。

  3. 模拟器问题:有时模拟器本身可能存在问题。尝试重启模拟器或创建新的模拟器实例来查看问题是否仍然存在。

  4. 代码问题:升级IDE可能导致之前未暴露的代码问题显现。检查日志输出,查找可能导致闪退的具体代码位置,特别是与UI渲染相关的代码。

  5. 清理和重建项目:在DevEco Studio中执行“Clean Project”和“Rebuild Project”操作,以解决潜在的构建缓存问题。

如果问题依旧没法解决请联系官网客服,官网地址是 https://www.itying.com/category-93-b0.html

回到顶部