flutter 我有一个生成APK错误在发布与DIO

vd2z7a6w  于 2023-08-07  发布在  Flutter
关注(0)|答案(1)|浏览(153)

我目前正在开发一个应用程序,当使用调试中的服务时,它们工作得很好,但当在发布中制作APK时,DIO不会让使用服务。
这是我的宣言:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.cashpak.app">

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.USE_BIOMETRIC" />
    <uses-permission android:name="android.permission.USE_FINGERPRINT" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.USE_BIOMETRIC" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />

    <uses-feature
        android:name="android.hardware.location"
        android:required="false" />

    <uses-feature
        android:name="android.hardware.telephony"
        android:required="false" />

    <uses-feature
        android:name="android.hardware.wifi"
        android:required="false" />

    <application
        android:name="com.cashpak.app.CustomApp"
        android:allowBackup="false"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/allAppName"
        android:networkSecurityConfig="@xml/network_security_config"
        tools:ignore="DataExtractionRules"
        tools:targetApi="n">
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />

        <activity
            android:name="com.cashpak.app.MainActivity"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:exported="true"
            android:hardwareAccelerated="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:windowSoftInputMode="adjustResize">

            <!--
                 Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI.
            -->
            <meta-data
                android:name="io.flutter.embedding.android.NormalTheme"
                android:resource="@style/NormalTheme" />

            <meta-data
                android:name="com.google.firebase.messaging.default_notification_channel_id"
                android:value="high_importance_channel" />

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <!--
 Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java
        -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>

</manifest>

字符串
这是我的Pubspec.yaml

name: cashpak_mobile
description: 
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+2

environment:
  sdk: '>=2.18.6 <3.0.0'

data:
    path: data

dependencies:
  flutter:
    sdk: flutter
  flutter_native_splash: ^2.2.2
  cupertino_icons: ^1.0.4
  connectivity_plus: ^2.3.0
  crypto: ^3.0.2
  encrypt: ^5.0.1
  logger: ^1.1.0
  dio: ^4.0.6
  json_annotation: ^4.7.0
  intl: ^0.18.0
  flutter_riverpod: ^1.0.4
  flutter_secure_storage: ^5.0.2
  shared_preferences: ^2.0.15
  firebase_crashlytics: ^3.3.4
  firebase_analytics: ^10.4.4
  firebase_core: ^2.15.0
  package_info: ^2.0.2
  launch_review: ^3.0.1
  flutter_localizations:
    sdk: flutter
  flutter_svg: ^1.1.0
  flutter_html: ^3.0.0-alpha.5
  device_preview: ^1.1.0
  google_sign_in: ^5.4.0
  # firebase_auth: ^3.3.19
  step_progress_indicator: ^1.0.2
  share_plus: ^4.0.7
  screenshot: ^2.1.0
  path_provider: ^2.0.11
  package_info_plus: ^4.0.2
  pinput: ^2.2.31
  flutter_holo_date_picker: ^1.0.3
  device_info_plus: ^9.0.2
  auto_size_text: ^3.0.0
  url_launcher: ^6.1.5
  dart_ipify: ^1.1.1
  geolocator: ^9.0.1
  flutter_spinkit: ^5.1.0
  flutter_speed_dial: ^6.2.0
  flutter_countdown_timer: ^4.1.0
  timer_count_down: ^2.2.1
  local_auth: ^2.1.3
  permission_handler: ^10.2.0
  flutter_contacts: ^1.1.6
  webview_flutter: ^4.0.7
  qr_flutter: ^4.0.0
  firebase_messaging: ^14.6.5
  flutter_local_notifications: ^14.1.1
  fluttertoast: ^8.2.2
  flutter_scripts: ^0.0.3

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^2.0.1
  retrofit_generator: ^4.2.0
  build_runner: ^2.4.6

flutter:
  uses-material-design: true

  assets:
    - assets/images/
    - assets/dummy/
  
  fonts:
    - family: SourceSansPro
      fonts:
        - asset: assets/fonts/SourceSansPro-Regular.ttf
        - asset: assets/fonts/SourceSansPro-Bold.ttf
          weight: 700

flutter_intl:
  main_locale: es
  enabled: true

flutter_native_splash:
  image: 'assets/splash_content.png'
  color: '#185CE5'
  image_dark: 'assets/splash_content.png'
  color_dark: '#185CE5'

scripts:
  build_runner: flutter pub run build_runner build


我试过使用和不使用混淆代码,我已经添加和删除了清单中的权限,但没有。

e0uiprwp

e0uiprwp1#

如果您使用的是HTTP地址,请确保您已在AndroidManifest.xml中的应用程序标记内添加了usesCleartextTraffic=true。这将确保即使您的API端点不安全,您仍然可以调用API。

<application
    android:usesCleartextTraffic="true">

字符串

相关问题