首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >颤振Webrtc在M1、安卓和ios上的构建错误

颤振Webrtc在M1、安卓和ios上的构建错误
EN

Stack Overflow用户
提问于 2022-02-07 19:36:56
回答 1查看 1.9K关注 0票数 4

我正试图在我的m1 macbook上构建一个webrtc颤振应用程序。但我在android和ios上都遇到了不同的问题。最新版本^0.8.2都有错误,那么^0.7.0+hotfix.1演示演示只适用于android。

在iOS部分,利比亚的部署目标设置为8.0,但部署目标为9.0,我将部署目标设置在10以上,然后仍然发生。

代码语言:javascript
运行
复制
/Users/alperenbaskaya/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.7.1/ios/Classes/FlutterWebRTCPlugin.h:8:9: fatal error: 'WebRTC/WebRTC.h' file not found
    #import <WebRTC/WebRTC.h>
            ^~~~~~~~~~~~~~~~~
    1 error generated.
/Users/alperenbaskaya/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.7.1/ios/Classes/FlutterRTCMediaStream.m:3:9: fatal error: 'WebRTC/WebRTC.h' file not found
    #import <WebRTC/WebRTC.h>
            ^~~~~~~~~~~~~~~~~
    1 error generated.
In file included from /Users/alperenbaskaya/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.7.1/ios/Classes/FlutterRTCFrameCapturer.m:8:
/Users/alperenbaskaya/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.7.1/ios/Classes/FlutterRTCFrameCapturer.h:6:9: fatal error: 'WebRTC/WebRTC.h' file not found
    #import <WebRTC/WebRTC.h>
            ^~~~~~~~~~~~~~~~~
    1 error generated.
In file included from /Users/alperenbaskaya/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.7.1/ios/Classes/FlutterRTCDataChannel.m:2:
In file included from /Users/alperenbaskaya/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.7.1/ios/Classes/FlutterRTCDataChannel.h:1:
/Users/alperenbaskaya/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.7.1/ios/Classes/FlutterWebRTCPlugin.h:8:9: fatal error: 'WebRTC/WebRTC.h' file not found
    #import <WebRTC/WebRTC.h>
            ^~~~~~~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete
    /Users/alperenbaskaya/AndroidStudioProjects/flutter-webrtc-demo/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 4.3, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'Libyuv' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 8 Plus.

解决办法之后,我更新了libyuv部署目标,但现在我得到了以下ios错误;

代码语言:javascript
运行
复制
        objc[66512]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x20d426c10) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x113d3c2b8). One of the two will be used. Which one is undefined.
    objc[66512]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x20d426c60) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x113d3c308). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **
Xcode's output:
↳
    warning: [CP] Unable to find matching .xcframework slice in 'ios-arm64_x86_64-simulator ios-arm64_armv7' for the current build architectures (arm64 x86_64 i386).
In file included from /Users/alperenbaskaya/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.8.2/ios/Classes/FlutterRTCPeerConnection.m:2:
/Users/alperenbaskaya/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_webrtc-0.8.2/ios/Classes/FlutterWebRTCPlugin.h:8:9: fatal error: 'WebRTC/WebRTC.h' file not found
    #import <WebRTC/WebRTC.h>
            ^~~~~~~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete
Could not build the application for the simulator.
Error launching application on iPhone 8 Plus.

在android方面,我得到了跟踪;

代码语言:javascript
运行
复制
Execution failed for task ':flutter_webrtc:compileDebugJavaWithJavac'.
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-02-08 10:22:25

对于^0.8.2版本,下面的解决方案适用于我。

iOS

在ios/Podfile中,将以下内容添加到文件的末尾。

代码语言:javascript
运行
复制
    post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |build_configuration|
      build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
    end
  end
end

然后,清理您的项目,并遵循这些步骤,如桑托沙基尔提到的桑托沙基尔;(这些步骤对我有效,如果没有遵循链接中提到的所有步骤)

代码语言:javascript
运行
复制
flutter clean && flutter pub get
cd ios
arch -x86_64 pod update
arch -x86_64 pod install
then at the top of your Pod file, paste this line platform :ios, '10.0'
right click on ios folder and open in xcode and then set all deployment target to 10

Android你的android/app/build.gradle如下所示:webrtcflutterdemo

代码语言:javascript
运行
复制
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

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

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

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.cloudwebrtc.flutterwebrtcdemo"
        minSdkVersion 21 
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    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
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/proguard/androidx-annotations.pro'
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

android/app/AndroidManifest.xml

代码语言:javascript
运行
复制
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.cloudwebrtc.flutterwebrtcdemo">

    <!-- The INTERNET permission is required for development. Specifically,
         flutter needs it to communicate with the running application
         to allow setting breakpoints, to provide hot reload, etc.
    -->
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <application
        android:label="flutter_webrtc_demo"
        android:icon="@mipmap/ic_launcher">
        <meta-data

编辑的安卓端,我不能构建编译31和targetsdk 31。临时解决方案是将编译程序降级到30。它是关于你的mac设备上的jdk版本。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71024372

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档