chabok-io / chabok-client-flutter

Chabok client for flutter
MIT License
4 stars 0 forks source link

code 1 error (Gradle task assembleDebug failed with exit code 1) #1

Closed jepbura closed 4 years ago

jepbura commented 4 years ago

Hi , سلام My app is not running on android am using android studio , sdk28 . //////////////////////////////////////////////////////////////////////////////////////////////////////////////// error:

> Launching lib\main.dart on google Pixel 2 in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
C:\flutter\.pub-cache\hosted\pub.dartlang.org\chabokpush-0.0.5\android\src\main\java\com\chabokpush\flutter\chabokpush\ChabokpushPlugin.java:16: error: package androidx.core.app does not exist
import androidx.core.app.NotificationCompat;
                        ^
C:\flutter\.pub-cache\hosted\pub.dartlang.org\chabokpush-0.0.5\android\src\main\java\com\chabokpush\flutter\chabokpush\ChabokpushPlugin.java:207: error: package NotificationCompat does not exist
      public boolean buildNotification(ChabokNotification message, NotificationCompat.Builder builder) {
                                                                                     ^
Note: C:\flutter\.pub-cache\hosted\pub.dartlang.org\chabokpush-0.0.5\android\src\main\java\com\chabokpush\flutter\chabokpush\ChabokpushPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.
*******************************************************************************************
Finished with error: Gradle task assembleDebug failed with exit code 1

//////////////////////////////////////////////////////////////////////////////////////////////////////////////// AndroidManifest.xml:

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

    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.READ_SMS" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.WRITE_SMS" />
    <uses-permission android:name="android.permission.CALL_PHONE" />

    <application
        android:name="io.flutter.app.FlutterApplication"
        android:icon="@mipmap/noja"
        android:label="Noja">

        <receiver
            android:name="com.google.android.gms.gcm.GcmReceiver"
            android:enabled="true"
            android:exported="true"
            android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="MY_APPLICATION_PACKAGE_ID" />
            </intent-filter>
        </receiver>
        <receiver
            android:name=".SMSReciver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="android.provider.Telephony.SMS_RECEIVED">

                </action>
            </intent-filter>
        </receiver>

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

            <!--
                 This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme).
            -->
            <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                android:value="true" />

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

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <meta-data android:name="com.adpdigital.push.client.SHOW_ONLY_CHABOK_NOTIFICATIONS" android:value="ENABLE" />

        <service android:name=".JEPServises" />
    </application>

</manifest>

//////////////////////////////////////////////////////////////////////////////////////////////////////////////// android/build.gradle :

> buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

task clean(type: Delete) {
    delete rootProject.buildDir
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////// android/app/build.gradle :

> 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.example.agri_mobile"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    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 {
    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'
    implementation 'com.android.support:support-compat:28.0.0-alpha1'

}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
gradle.properties :

> org.gradle.jvmargs=-Xmx1536M

//////////////////////////////////////////////////////////////////////////////////////////////////////////////// android\gradle\wrapper\gradle-wrapper.properties :

> #Sun Jul 14 21:58:49 IRDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

//////////////////////////////////////////////////////////////////////////////////////////////////////////////// flutter doctor -v

> [√] Flutter (Channel stable, v1.9.1+hotfix.5, on Microsoft Windows [Version 10.0.17763.678], locale fa-IR)
    • Flutter version 1.9.1+hotfix.5 at C:\flutter
    • Framework revision 1aedbb1835 (3 days ago), 2019-10-17 08:37:27 -0700
    • Engine revision b863200c37
    • Dart version 2.5.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\sdk\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = C:\sdk\sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    • All Android licenses accepted.

[√] Android Studio (version 3.5)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 40.2.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code (version 1.39.2)
    • VS Code at C:\Users\JEPBURA\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.5.1

[√] Connected device (1 available)
    • google Pixel 2 • 127.0.0.1:62001 • android-x86 • Android 7.1.2 (API 25)

• No issues found!

//////////////////////////////////////////////////////////////////////////////////////////////////////////////// pubspec.yaml :

> name: agri_mobile
description: A new Flutter project.

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.2.0 <3.0.0"

dependencies:
  gradient_app_bar: ^0.0.1
  sms: ^0.2.4
  fcharts: ^0.0.9
  json_serializable: ^1.1.0
  url_launcher: ^5.0.1
  path_provider: ^1.1.0
  splashscreen: ^1.2.0
  connectivity: ^0.4.3+1
  sqflite: ^1.1.5
  shared_preferences: ^0.5.3+4
  flare_flutter: ^1.5.9
  chabokpush: ^0.0.5

  flutter_launcher_icons: "^0.7.0"
  http: ^0.12.0+2
  flutter:
    sdk: flutter
  cupertino_icons: ^0.1.2
  groovin_material_icons: ^1.1.6

  dynamic_theme: ^1.0.1
  marquee_flutter: ^0.1.4

  flutter_datetime_picker: ^1.2.1
  shamsi_date: ^0.5.5

  flutter_circular_chart: ^0.1.0
  fl_chart: ^0.0.8

  bubbled_navigation_bar: ^0.0.3
  fancy_bottom_navigation: ^0.3.2

  rflutter_alert: ^1.0.3
  ....
  .
  .
  .
  .

//////////////////////////////////////////////////////////////////////////////////////////////////////////////// Persian Language :

سلام پروژه من قبل از اضافه کردن پکیج چابک مشکلی نداشت و راحت اجرا میشد .اما با اضافه شدن این پکیج به مشکل گفته شده در اول صفحه بر میخورم نا گفته نمونه من این مشکل رو با فایربیس هم داشتم اما با تبدیل پروژم به اندروید ایکس و تغییر ورژن هایی در گردل ها این مشکلو برطرف کردم لطفا راهنماییم کنید که برای پکیج شما باید چیکار کنم و چه ورژن هایی استفاده کنم در ضمن مثالی که برای این پکیج زدید تو قسمت جاوا و گردل ها یه چیزهایی قرار دادید که در آموزش سایتتون قرار ندادید من از آخرین ورژن های فلاتر و دارت و ... استفاده میکنم لطفا بیشتر راهنماییم کنید ممنون

jepbura commented 4 years ago

باشه اما من الان در حال حاضر از androidX استفاده نمیکنم مشکل از چیز دیگه ایی هست برای فایربیس از androidX استفاده کردم

Husseinhj commented 4 years ago

عذرخواهی می‌کنم بخاطر اشتباه در پیام قبلیم، کتابخونه فلاتر چابک از androidX استفاده می‌کنه.

متن خطا زیر به این معنی هست که پروژه شما احتمالا روی اندروید ایکس نرفته

error: package androidx.core.app does not exist
import androidx.core.app.NotificationCompat;

بخش مهاجرت به androidX را مطالعه کنید

jepbura commented 4 years ago

بعد از تبدیل حالا این مشکلو نشون میده

Launching lib\main.dart on SM G950F in debug mode... Initializing gradle... Resolving dependencies... Running Gradle task 'assembleDebug'... Note: C:\flutter.pub-cache\hosted\pub.dartlang.org\connectivity-0.4.4\android\src\main\java\io\flutter\plugins\connectivity\ConnectivityPlugin.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: C:\flutter.pub-cache\hosted\pub.dartlang.org\sms-0.2.4\android\src\main\java\com\babariviere\sms\telephony\TelephonyManager.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: C:\flutter.pub-cache\hosted\pub.dartlang.org\chabokpush-0.0.5\android\src\main\java\com\chabokpush\flutter\chabokpush\ChabokpushPlugin.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: C:\flutter.pub-cache\hosted\pub.dartlang.org\url_launcher-5.1.4\android\src\main\java\io\flutter\plugins\urllauncher\WebViewActivity.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. C:\Users\JEPBURA\Desktop\me\agri_mobile\android\app\src\debug\AndroidManifest.xml:16:9-29 Error: Attribute application@label value=(Noja) from AndroidManifest.xml:16:9-29 is also present at [chabok-lib-2.17.2.aar] AndroidManifest.xml:41:18-50 value=(@string/app_name). Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml:13:5-65:19 to override. Finished with error: Gradle task assembleDebug failed with exit code 1

farbod-s commented 4 years ago
سلام
در انتهای پیام خطا برای برطرف شدن مشکل پیشنهادی داده شده

Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml‍‍‍‍‍‍‍‍

باید این دستور رو داخل تگ Application برنامه‌تون اضافه کنید:

<application tools:replace="android:label"> </application>

بنظر میاد این Attribute اضافی هستش و باید از داخل کتابخانه پاک بشه
ممنون که اطلاع دادید
فعلا این issue رو می‌بندیم ولی باز اگه مشکلی بود مجدد همین issue رو باز کنید