pusheco / pushe-flutter

Pushe plugin for Flutter framework
Other
14 stars 4 forks source link

annotation ارور #3

Closed amirrezasalimi closed 4 years ago

amirrezasalimi commented 4 years ago
سلام من ارور زیر رو دارم وقتی لایبرری پوشه رو اد میکنم به پروژه
Launching lib\main.dart on SM G531H in debug mode...
E:\Android\Flutter\.pub-cache\hosted\pub.dartlang.org\pushe-1.0.0\android\src\main\java\co\ronash\pushe\flutter\PusheApplication.java:7: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
E:\Android\Flutter\.pub-cache\hosted\pub.dartlang.org\pushe-1.0.0\android\src\main\java\co\ronash\pushe\flutter\PushePlugin.java:7: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
E:\Android\Flutter\.pub-cache\hosted\pub.dartlang.org\pushe-1.0.0\android\src\main\java\co\ronash\pushe\flutter\PushePlugin.java:49: error: cannot find symbol
    public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
                              ^
  symbol:   class NonNull
  location: class PushePlugin
E:\Android\Flutter\.pub-cache\hosted\pub.dartlang.org\pushe-1.0.0\android\src\main\java\co\ronash\pushe\flutter\PushePlugin.java:49: error: cannot find symbol
    public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
                                                        ^
  symbol:   class NonNull
  location: class PushePlugin
E:\Android\Flutter\.pub-cache\hosted\pub.dartlang.org\pushe-1.0.0\android\src\main\java\co\ronash\pushe\flutter\PusheApplication.java:28: error: cannot find symbol
            public void onNotificationReceived(@NonNull final NotificationData notificationData) {
                                                ^
  symbol: class NonNull
E:\Android\Flutter\.pub-cache\hosted\pub.dartlang.org\pushe-1.0.0\android\src\main\java\co\ronash\pushe\flutter\PusheApplication.java:35: error: cannot find symbol
            public void onNotificationClicked(@NonNull final NotificationData notificationData) {
                                               ^
  symbol: class NonNull
E:\Android\Flutter\.pub-cache\hosted\pub.dartlang.org\pushe-1.0.0\android\src\main\java\co\ronash\pushe\flutter\PusheApplication.java:42: error: cannot find symbol
            public void onNotificationButtonClicked(@NonNull final NotificationData notificationData,
                                                     ^
  symbol: class NonNull
E:\Android\Flutter\.pub-cache\hosted\pub.dartlang.org\pushe-1.0.0\android\src\main\java\co\ronash\pushe\flutter\PusheApplication.java:43: error: cannot find symbol
                                                    @NonNull final NotificationButtonData notificationButtonData) {
                                                     ^
  symbol: class NonNull
E:\Android\Flutter\.pub-cache\hosted\pub.dartlang.org\pushe-1.0.0\android\src\main\java\co\ronash\pushe\flutter\PusheApplication.java:51: error: cannot find symbol
            public void onCustomContentReceived(@NonNull final JSONObject jsonObject) {
                                                 ^
  symbol: class NonNull
E:\Android\Flutter\.pub-cache\hosted\pub.dartlang.org\pushe-1.0.0\android\src\main\java\co\ronash\pushe\flutter\PusheApplication.java:58: error: cannot find symbol
            public void onNotificationDismissed(@NonNull final NotificationData notificationData) {
                                                 ^
  symbol: class NonNull
10 errors

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':pushe:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* 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 22s
*******************************************************************************************
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.
*******************************************************************************************
Gradle task assembleDebug failed with exit code 1

build.gradle file (dependencies):

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    annotationProcessor 'androidx.annotation:annotation:1.1.0'
}

flutter doctor :

[flutter] flutter doctor -v
[√] Flutter (Channel stable, v1.9.1+hotfix.2, on Microsoft Windows [Version 10.0.17763.737], locale en-US)
    • Flutter version 1.9.1+hotfix.2 at E:\Android\Flutter
    • Framework revision 2d2a1ffec9 (8 days ago), 2019-09-06 18:39:49 -0700
    • Engine revision b863200c37
    • Dart version 2.5.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
    • Android SDK at F:\Users\Amir\AppData\Local\Android\Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.1
    • Java binary at: C:\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[√] Android Studio (version 3.4)
    • Android Studio at C:\Android\Android Studio
    • Flutter plugin version 38.2.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[√] VS Code (version 1.38.1)
    • VS Code at C:\Users\Amir\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.4.1

[√] Connected device (1 available)
    • SM G531H • 192.168.1.101:5555 • android-arm • Android 5.1.1 (API 22)

• No issues found!
exit code 0
mahdi-malv commented 4 years ago
سلام توی ارور به `@NonNull` های داخل کد نیتیو اشاره‌کرده که یعنی _android.support.annotation_ در پروژه وجود نداره. ولی توی لایبرری‌ها _androidx.annotation_ هست. لذا کافیه که **jettifier** رو فعال کنید. موارد زیر رو به‌انتهای فایل گفته‌شده اضافه‌کنید.

gradle.properies (In android directory):

android.useAndroidX=true
android.enableJetifier=true

Reference

و ممنون میشم بگید مورد حل‌ می‌شه یا هنوز‌هم هست؟
amirrezasalimi commented 4 years ago
ممنون از شما . قبلا تبدیل کرده بودم به androidX درست نشد الان مجبور شدم دستی `import androidx.annotation.*` رو جایگزین کنم تو کتابخانه پوشه مشکلی نداره اینکار ؟ یااگه میشه یه نسخه بدین مخصوص androidX خیلی ممنون
mahdi-malv commented 4 years ago
برای لایبرری که نباید موردی باشه مایگریت پروژه به **AndroidX** ممکنه. اما فعلا نگرانی در مورد پشتیبانی از پروژه‌هایی خواهد بود که androidx نیستن. این مورد رو بیشتر تو تیم بررسی می‌کنیم و راه‌حلش رو در اسرع‌وقت اعمال خواهیم‌کرد.
mahdi-malv commented 4 years ago
سلام نسخه‌ی 1.0.1 رو لطفا تست کنید. همچنین نیازی به اضافه‌کردن لایبرری `annotations` نیست و می‌تونید اون رو پاک کنید.
amirrezasalimi commented 4 years ago

سلام تو سایت https://pub.dev/packages/pushe/versions چک کردم آپدیت نکردید فکر کنم

mahdi-malv commented 4 years ago

سلام عذرخواهی ‌می‌کنم. یه مورد توی پروسه پیش‌اومده بود. الان اوکی شده و می‌تونید تست‌کنید.

amirrezasalimi commented 4 years ago

آقا ممنونم از پشتیبانی خوبتون , فکر میکنم درست شد تشکر