国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

[Flutter]導(dǎo)入singular_flutter_sdk后運(yùn)行到Android報(bào)錯(cuò)

這篇具有很好參考價(jià)值的文章主要介紹了[Flutter]導(dǎo)入singular_flutter_sdk后運(yùn)行到Android報(bào)錯(cuò)。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

問題:

接入歸因之前,flutter項(xiàng)目一起正常。接入歸因之后,iOS正常Android有問題。

dependencies:  
  # Singular歸因
  singular_flutter_sdk: ^1.3.3

針對(duì) Flutter 的 Singular SDK 集成指南

https://support.singular.net/hc/zh-cn/articles/4408894547227-%E9%92%88%E5%AF%B9-Flutter-%E7%9A%84-Singular-SDK-%E9%9B%86%E6%88%90%E6%8C%87%E5%8D%97

當(dāng)前環(huán)境配置

android/app/build.gradle

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
    // 應(yīng)用Google服務(wù)Gradle插件
    id 'com.google.gms.google-services'
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

android {
    namespace "com.teleprom.www"
    // compileSdkVersion是用來編譯你的應(yīng)用的API級(jí)別。它指定了編譯時(shí)使用的Android API版本。你的代碼將會(huì)使用這個(gè)版本的Android API進(jìn)行編譯。它應(yīng)該是你打算使用的最新穩(wěn)定版API版本。
    compileSdk flutter.compileSdkVersion
    // ndkVersion是指定項(xiàng)目要使用的Android NDK(Native Development Kit)的版本。NDK允許你使用C和C++代碼來編譯本地代碼,通常用于性能敏感的部分。當(dāng)你使用需要NDK的插件或直接編寫本地代碼時(shí),這個(gè)版本就變得重要。
    //ndkVersion flutter.ndkVersion
    ndkVersion "25.1.8937393"  

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

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

    defaultConfig {
        applicationId "com.teleprom.www"
        // minSdkVersion指定了能夠運(yùn)行你的應(yīng)用的最低Android API級(jí)別。如果一個(gè)設(shè)備的API級(jí)別低于這個(gè)值,該設(shè)備將無法在Google Play商店安裝或運(yùn)行你的應(yīng)用。這個(gè)值應(yīng)該盡可能低,以覆蓋更廣泛的用戶,但同時(shí)要高到足以支持應(yīng)用所需功能的API級(jí)別。
        //minSdkVersion flutter.minSdkVersion
        minSdkVersion 22  
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    // 添加Firebase Analytics依賴
    implementation platform('com.google.firebase:firebase-bom:32.7.4') // 使用適合你項(xiàng)目的最新BOM版本
    implementation 'com.google.firebase:firebase-analytics'
    // 依賴關(guān)系列表中添加 Singular 庫(kù)
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    // 注意: 如果在構(gòu)建時(shí)出現(xiàn)DuplicateClasses(重復(fù)類 )錯(cuò)誤,則可能已經(jīng)安裝了 Google play-services,可以注釋掉該依賴關(guān)系。
    implementation 'com.android.installreferrer:installreferrer:2.2'
    implementation 'com.google.android.gms:play-services-appset:16.0.2'
}

android/build.gradle

buildscript {
    ext.kotlin_version = ''1.9.23'
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.1.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

settings.gradle

pluginManagement {
    def flutterSdkPath = {
        def properties = new Properties()
        file("local.properties").withInputStream { properties.load(it) }
        def flutterSdkPath = properties.getProperty("flutter.sdk")
        assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
        return flutterSdkPath
    }
    settings.ext.flutterSdkPath = flutterSdkPath()

    includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")

    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "8.1.3" apply false 
    id "org.jetbrains.kotlin.android" version "1.9.23" apply false
    // 添加Google服務(wù)插件. apply false 表示該插件不會(huì)立即應(yīng)用到項(xiàng)目中,而是可以在子項(xiàng)目(模塊)中單獨(dú)應(yīng)用。
    id 'com.google.gms.google-services' version '4.3.15' apply false
}

include ":app"

gradle/wrapper/gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl = https\://services.gradle.org/distributions/gradle-8.4-bin.zip

運(yùn)行到Android報(bào)錯(cuò)1

報(bào)錯(cuò)日志:

Launching lib/main.dart on vivo X20 in debug mode...

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':singular_flutter_sdk'.
> Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
   > Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.

     If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Failed to query the value of property 'buildFlowServiceProperty'.
> Could not isolate value org.jetbrains.kotlin.gradle.plugin.statistics.BuildFlowService$Parameters_Decorated@7d79dba7 of type BuildFlowService.Parameters
   > A problem occurred configuring project ':singular_flutter_sdk'.
      > Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
         > Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.

           If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

BUILD FAILED in 4s
Error: Gradle task assembleDebug failed with exit code 1


Exited (1).

解決:

按照搜索到的辦法,并非所有包都支持版本 8.xx,將 Android Gridle 插件版本 8.1.3 降級(jí)到 7.4.2 來解決這個(gè)問題。

flutter firebase app not running on Android: Namespace not specified - Stack Overflow

android/build.gradle:

buildscript {
    ext.kotlin_version = ''1.8.0'
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}
...

settings.gradle

...
plugins {
    id "com.android.application" version "7.4.2" apply false 
    id "org.jetbrains.kotlin.android" version "1.8.0" apply false
	...
}

gradle/wrapper/gradle-wrapper.properties

...
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip

?

運(yùn)行到Android報(bào)錯(cuò)ERROR:D8: com.android.tools.r8.kotlin.H

修復(fù)完第一個(gè)問題后,運(yùn)行包這個(gè)錯(cuò)誤。

報(bào)錯(cuò)日志:

Launching lib/main.dart on vivo X20 in debug mode...
注: /Users/gamin/.pub-cache/hosted/pub.flutter-io.cn/singular_flutter_sdk-1.3.3/android/src/main/java/com/singular/flutter_sdk/SingularSDK.java使用了未經(jīng)檢查或不安全的操作。
注: 有關(guān)詳細(xì)信息, 請(qǐng)使用 -Xlint:unchecked 重新編譯。
ERROR:D8: com.android.tools.r8.kotlin.H

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeExtDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform play-services-measurement-api-21.5.1.aar (com.google.android.gms:play-services-measurement-api:21.5.1) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=22, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: /Users/gamin/.gradle/caches/transforms-3/4e42575ef433f9d8bb5373944a07a9ed/transformed/jetified-play-services-measurement-api-21.5.1-runtime.jar.
         > Error while dexing.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3m 55s


┌─ Flutter Fix ──────────────────────────────────────────────────────────────┐
│ [!] The shrinker may have failed to optimize the Java bytecode.            │
│ To disable the shrinker, pass the `--no-shrink` flag to this command.      │
│ To learn more, see: https://developer.android.com/studio/build/shrink-code │
└────────────────────────────────────────────────────────────────────────────┘
Error: Gradle task assembleDebug failed with exit code 1


Exited (1).

解決:

有個(gè)類似問題:https://github.com/flutter/flutter/issues/146038

將最低支持版本從22升級(jí)到24

android/app/build.gradle:文章來源地址http://www.zghlxwxcb.cn/news/detail-851523.html

android {
    defaultConfig {
        minSdkVersion 24
    }
}

到了這里,關(guān)于[Flutter]導(dǎo)入singular_flutter_sdk后運(yùn)行到Android報(bào)錯(cuò)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Flutter配置Android SDK路徑

    Flutter配置Android SDK路徑

    在使用VSCode作為開發(fā)Flutter的工具時(shí),當(dāng)選擇調(diào)試設(shè)備時(shí),通??床坏絘ndroid的模擬器,只能看到Chrome之類的。 原因就是Flutter找不到Android的SDK路徑,所以無法識(shí)別模擬器,我們用flutter doctor命令檢查環(huán)境時(shí),就好看到提示。 我們只需要為Flutter指定正確的SDK路徑即可,命令如下

    2024年02月07日
    瀏覽(19)
  • Flutter項(xiàng)目的sdk版本管理工具

    Flutter項(xiàng)目的sdk版本管理工具

    flutter項(xiàng)目的sdk版本使用是一個(gè)很尷尬的問題,一個(gè)項(xiàng)目一個(gè)SDK,電腦系統(tǒng)還只能裝一個(gè)SDK,這就使我們開發(fā)當(dāng)中很尷尬,好幾個(gè)項(xiàng)目分別使用不同的SDK就很難辦了,不可能來回升級(jí)降級(jí)SDK,現(xiàn)在市面有SDK版本管理工具,雖然不是很友好,但是也算一個(gè)解決辦法,下面說一下解

    2024年04月14日
    瀏覽(24)
  • Flutter集成UniMPSDK(Uni小程序SDK)

    SDK文件結(jié)構(gòu)如下: 小程序打包基座: 提示:盡量與 UniMPSDK 版本一致 libs依賴庫(kù)配置 查看Flutter項(xiàng)目中 android/app 目錄中是否存在 libs 文件夾,沒有就創(chuàng)建。 將 SDK-Android@3.98-20231127/SDK/libs 中相應(yīng)的依賴復(fù)制到 項(xiàng)目 android/app/libs/ libs 文件夾依賴庫(kù)可根據(jù)功能需要進(jìn)行增加或刪除,

    2024年04月16日
    瀏覽(17)
  • Flutter 版本更新 和 dart SDK版本跟新

    Flutter 版本更新 和 dart SDK版本跟新

    報(bào)錯(cuò)啦怎么辦? 找到了我的電腦里面dart SDK的位置, D:Flutterflutterbincachedart-sdk 我認(rèn)為是dart的版本不夠的時(shí)候,我就去下載新的dart SDK(下載地址:Archive | Dart ),然后去替換我之前的dart-sdk,然后就出現(xiàn)問題了,官方的flutter sdk中已經(jīng)自帶了匹配版本的dart sdk。所以不要自

    2024年02月14日
    瀏覽(25)
  • flutter TARGET_SDK_VERSION和android 13

    flutter TARGET_SDK_VERSION和android 13

    config.gradle app/build.gradle里面的 有時(shí)候谷歌會(huì)讓你發(fā)的app版本起碼為android 13,那就要改上面的TARGET_SDK_VERSION

    2024年02月11日
    瀏覽(22)
  • flutter創(chuàng)建/導(dǎo)入?yún)^(qū)塊鏈錢包,獲取余額

    flutter創(chuàng)建/導(dǎo)入?yún)^(qū)塊鏈錢包,獲取余額

    作為區(qū)塊鏈行業(yè)小白剛接觸區(qū)塊鏈錢包幾天,來開發(fā)錢包還是需要付出很多努力的.下面記錄一下flutter框架下創(chuàng)建/導(dǎo)入?yún)^(qū)塊鏈錢包,并獲取余額 一、創(chuàng)建錢包: 錢包的創(chuàng)建分為三個(gè)步驟: 1、生成助記詞 (1)、創(chuàng)建助記詞: 需要用到bip39插件 (2)、創(chuàng)建方式: 2、助記詞生成私鑰 (1)、生

    2024年02月06日
    瀏覽(36)
  • Flutter 與第三方 Native-SDK 的交互代理方案

    Flutter 與第三方 Native-SDK 的交互代理方案

    場(chǎng)景 在使用 Flutter 進(jìn)行功能模塊或者整體項(xiàng)目的開發(fā)時(shí),如果需要(階段性)頻繁地和某個(gè)第三方 Native-SDK 進(jìn)行交互,而該 Native-SDK 沒有實(shí)現(xiàn) Flutter 插件版本的情況下,如果直接把這部分交互 API 加入到原有的 channel 類里面,會(huì)使得該 channel 類變得臃腫,造成代碼維護(hù)及迭代

    2024年02月02日
    瀏覽(23)
  • 集成 Firebase 后,F(xiàn)lutter IM SDK 在 Android 端不觸發(fā)回調(diào)

    描述 客戶已集成 Firebase Messaging,Android 平臺(tái) Flutter IM SDK 的不觸發(fā)任何回調(diào)。 分析(根因分析、需求分析) 可能原因是客戶構(gòu)建了一個(gè) FlutterEngine instance,導(dǎo)致 SDK 的 FlutterEngine instance 失效了。 解決方案 找到以下 java 文件 packages/firebase_messaging/firebase_messaging/android/src/main/jav

    2024年02月01日
    瀏覽(19)
  • flutter App如何跳轉(zhuǎn)小程序如何調(diào)用微信sdk(ios/andriod)

    flutter App如何跳轉(zhuǎn)小程序如何調(diào)用微信sdk(ios/andriod)

    ? ? ? ? 實(shí)不相瞞,這一塊著實(shí)耗費(fèi)了我很大的時(shí)間,因?yàn)闆]有太多ios和andriod原生開發(fā)的知識(shí)儲(chǔ)備,在很多方面就會(huì)踩不少坑,這里總結(jié)幾種app跳轉(zhuǎn)微信小程序的方式 第一種方案:使用明文URL Scheme 這是最簡(jiǎn)單!不需要太多配置的方式!但是這里有一個(gè)坑就是對(duì)于ios是無痛拉

    2024年03月14日
    瀏覽(105)
  • flutter_inappwebview包引入后總要求Android SDK 33版本的問題

    今天想使用flutter_inappwebview來顯示網(wǎng)頁(yè),直接在pubspec.yaml中引入包文件: ?

    2023年04月20日
    瀏覽(27)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包