wilburx9 / flutter_paystack

:credit_card: A robust Flutter plugin for making payments via Paystack Payment Gateway. Completely supports Android and iOS
https://pub.dartlang.org/packages/flutter_paystack
Apache License 2.0
212 stars 390 forks source link

Unresolved reference: VERSION_NAME and VERSION_CODE #83

Closed Bharavi26 closed 3 years ago

Bharavi26 commented 3 years ago

F:\flutter_sdk\flutter.pub-cache\hosted\pub.dartlang.org\flutter_paystack-1.0.4+1\android\src\main\kotlin\co\paystack\flutterpaystack\MethodCallHandlerImpl.kt: (32, 96): Unresolved reference: VERSION_NAME F:\flutter_sdk\flutter.pub-cache\hosted\pub.dartlang.org\flutter_paystack-1.0.4+1\android\src\main\kotlin\co\paystack\flutterpaystack\MethodCallHandlerImpl.kt: (36, 44): Unresolved reference: VERSION_CODE

Flutter Doctor F:\flutter_sdk\flutter\bin\flutter.bat doctor --verbose [√] Flutter (Channel dev, 1.26.0-1.0.pre, on Microsoft Windows [Version 10.0.19041.685], locale en-US) • Flutter version 1.26.0-1.0.pre at F:\flutter_sdk\flutter • Framework revision 63062a6443 (10 days ago), 2020-12-13 23:19:13 +0800 • Engine revision 4797b06652 • Dart version 2.12.0 (build 2.12.0-141.0.dev)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc4) • Android SDK at \AppData\Local\Android\Sdk • Platform android-30, build-tools 30.0.0-rc4 • ANDROID_SDK_ROOT = \AppData\Local\Android\Sdk • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.1.0) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.52.1) • VS Code at \AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.17.0

[√] Connected device (5 available) • Lenovo A7020a48 (mobile) • Android 6.0 (API 23) • vivo 1818 (mobile) • Android 10 (API 29) • Android SDK built for x86 (mobile) • Android 10 (API 29) (emulator) • Chrome (web) • Google Chrome 87.0.4280.88 • Edge (web) • Microsoft Edge 87.0.664.66

• No issues found! Process finished with exit code 0

MeherBa commented 3 years ago

Same issue here after upgrading gradle to version 4.1.1

vintx64 commented 3 years ago

i have the same issue

tahabutt96 commented 3 years ago

"getUserAgent" -> { //result.success("Android_" + Build.VERSION.SDK_INT + "Paystack" + BuildConfig.VERSIONNAME) result.success("Android" + "29" + "Paystack" + "1.0.0" ) }

    "getVersionCode" -> {
        //result.success(BuildConfig.VERSION_CODE.toString())
        result.success("1")
    }
herocodess commented 3 years ago

"getUserAgent" -> { //result.success("Android_" + Build.VERSION.SDK_INT + "Paystack" + BuildConfig.VERSIONNAME) result.success("Android" + "29" + "Paystack" + "1.0.0" ) }

    "getVersionCode" -> {
        //result.success(BuildConfig.VERSION_CODE.toString())
        result.success("1")
    }

this solved the issue for me

wilburx9 commented 3 years ago

Closing because it is a duplicate of #79

techbly commented 3 years ago

"getUserAgent" -> { //result.success("Android_" + Build.VERSION.SDK_INT + "Paystack" + BuildConfig.VERSIONNAME) result.success("Android" + "29" + "Paystack" + "1.0.0" ) }

    "getVersionCode" -> {
        //result.success(BuildConfig.VERSION_CODE.toString())
        result.success("1")
    }

this solved the issue for me

where should i paste this code

skemuel007 commented 3 years ago

Resolved mine by going to my Projects folder -> External Libraries -> Flutter Plugins -> Flutter_Paystack-{version} -> android -> src -> main -> kotlin -> co -> paystack -> flutterpaystack -> MethodCallHandlerImp.kt

Edit the file follows:

@SuppressLint("HardwareIds")
    override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
        when (call.method) {
            "getDeviceId" -> {
                val deviceId = Settings.Secure.getString(activity?.contentResolver, Settings.Secure.ANDROID_ID)
                result.success("androidsdk_$deviceId")
            }
            "getUserAgent" -> {
                //result.success("Android_" + Build.VERSION.SDK_INT + "_Paystack_" + BuildConfig.VERSION_NAME) -- _comment this line_
                result.success("Android_" + "29" + "_Paystack_" + "1.0.4" ) // -- _add this line_
            }

            "getVersionCode" -> {
                //result.success(BuildConfig.VERSION_CODE.toString())  -- _comment this line_
                result.success("1") // -- _add this line_
            }

            "getAuthorization" -> {
                authDelegate?.handleAuthorization(result, call)
            }
            "getEncryptedData" -> {
                val encryptedData = Crypto.encrypt(call.argument<String>("stringData").toString())
                result.success(encryptedData)
            }

            else -> result.notImplemented()
        }
    }
MridulSaikia112 commented 3 years ago

Its working for me Just need to replace the "getUserAgent" -> { //result.success("Android_" + Build.VERSION.SDK_INT + "Paystack" + BuildConfig.VERSIONNAME) result.success("Android" + "29" + "Paystack" + "1.0.0" ) }

with the below line "getVersionCode" -> { //result.success(BuildConfig.VERSION_CODE.toString()) result.success("1") }

GoodNewsOk commented 3 years ago

where can i find the project folder pls

skemuel007 commented 3 years ago

where can i find the project folder pls

Kindly go to your
Project folder -> External Libraries -> Flutter Plugins -> Flutter_Paystack-{version}-> android -> src -> main -> kotlin -> co -> paystack -> flutterpaystack -> MethodCallHandlerImp.kt