首页 > 解决方案 > Flutter,url_launcher 在调试模式下工作,但在 apk 中不工作

问题描述

1-颤振,url_launcher 在调试模式下工作,但在 apk 中不工作。2-url_launcher 工作 api 29 但不在 api 30 中工作。我的英语很糟糕,所以我很抱歉。我的主要问题是“Flutter,url_launcher 在调试模式下工作,但不在 apk 下工作”你能帮我吗?

TextButton(onPressed: () async {
                print(_gonderi.kanalID);
                if(await canLaunch("https://www.youtube.com/channel/" + _gonderi.kanalID)) {//youtubeChannel
                 await launch("https://www.youtube.com/channel/" + _gonderi.kanalID);//YoutubeChannel
                } else {
                  throw "Bu siteye ulaşılamıyor";
                }
                }, child: Container(
                  height: 100,
                  width: double.infinity,
                  child: Image.asset("assets/images/aboneOl.png"),
                ))

安卓/app/src/main/AndroidManifest.xml

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="com.android.vending.BILLING" />

    <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
 
            <data android:scheme="https" />
        </intent>
        <intent>
            <action android:name="android.intent.action.DIAL" />
            <data android:scheme="tel" />
        </intent>
    </queries>

安卓/应用程序/buildGradle

android {
compileSdkVersion 29

sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
}

lintOptions {
    disable 'InvalidPackage'
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.IzleKazan"
    minSdkVersion 19
    targetSdkVersion 29

安卓/buildGradle

    dependencies {
    classpath 'com.android.tools.build:gradle:4.1.1'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.google.gms:google-services:4.3.5'
}

标签: androidflutterdartdebuggingapk

解决方案


推荐阅读