Getting exception in build, when adding file_picker package - android

I added file_picker to pubspec.yaml, tried to build the app, and then I got this error.
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-4.0.2\android\src\main\java\com\mr\flutter\plugin\filepicker\FileUtils.java:186: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
^
symbol: variable R
location: class VERSION_CODES
I already ran flutter clean, rebuild and tried different versions of this package, but the error is still the same.

Try setting compileSdkVersion to 30 in build.gradle file
android {
compileSdkVersion 30
}

Related

Flutter Webview throws compiling error -ThreadedInputConnectionProxyAdapterView location: class InputAwareWebView

I am using Webview version
webview_flutter: ^2.0.6
The android studio while running throws this error and stop the build
Os Version
minSdkVersion 19
targetSdkVersion 30
A:\flutter.pub-cache\hosted\pub.dartlang.org\webview_flutter-2.0.6\android\src\main\java\io\flutter\plugins\webviewflutter\InputAwareWebView.java:31:
error: cannot find symbol private
ThreadedInputConnectionProxyAdapterView proxyAdapterView;
^ symbol: class ThreadedInputConnectionProxyAdapterView location: class InputAwareWebView
A:\flutter.pub-cache\hosted\pub.dartlang.org\webview_flutter-2.0.6\android\src\main\java\io\flutter\plugins\webviewflutter\InputAwareWebView.java:112:
error: cannot find symbol
new ThreadedInputConnectionProxyAdapterView(
^ symbol: class ThreadedInputConnectionProxyAdapterView location: class
InputAwareWebView Note: Some input files use or override a deprecated
API. Note: Recompile with -Xlint:deprecation for details. 2 errors
FAILURE: Build failed with an exception.
How to fix this error?
ThreadedInputConnectionProxyAdapterView has wrong extension .jav
just change it to .java until the flutter team release the fix.
Please refer to the github link for the issue
https://github.com/flutter/flutter/issues/82800
As Ravi stated, renaming the file extension to .java does the trick.
The file can be found at:
{your flutter folder}\.pub-cache\hosted\pub.dartlang.org\webview_flutter-2.0.6\android\src\main\java\io\flutter\plugins\webviewflutter\ThreadedInputConnectionProxyAdapterView.java

Cannot build Flutter App (Android) after install wechat_assets_picker

I recently installed wechat_assets_picker, however when trying to build for android I get the following error, nothing in thier docs about it and no issues on thier issue list either.
e: /Users/remelehane/.pub-cache/hosted/pub.dartlang.org/photo_manager-0.6.0/android/src/main/kotlin/top/kikt/imagescanner/core/PhotoManagerDeleteManager.kt: (116, 36): Unresolved reference: R
e: /Users/remelehane/.pub-cache/hosted/pub.dartlang.org/photo_manager-0.6.0/android/src/main/kotlin/top/kikt/imagescanner/core/PhotoManagerDeleteManager.kt: (119, 36): Unresolved reference: createTrashRequest
e: /Users/remelehane/.pub-cache/hosted/pub.dartlang.org/photo_manager-0.6.0/android/src/main/kotlin/top/kikt/imagescanner/core/PhotoManagerPlugin.kt: (341, 84): Unresolved reference: R
e: /Users/remelehane/.pub-cache/hosted/pub.dartlang.org/photo_manager-0.6.0/android/src/main/kotlin/top/kikt/imagescanner/core/utils/Android30DbUtils.kt: (34, 34): Unresolved reference: R
e: /Users/remelehane/.pub-cache/hosted/pub.dartlang.org/photo_manager-0.6.0/android/src/main/kotlin/top/kikt/imagescanner/core/utils/IDBUtils.kt: (27, 67): Unresolved reference: R
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':photo_manager:compileReleaseKotlin'.
> Compilation error. See log for more details
The erroring line is #RequiresApi(Build.VERSION_CODES.R) which from what I understand means this function on runs in version R of the android SDK, which is OS11, so should not be affecting the build?
I checked with the example project which is running SDK min 21 and compiled of 29.
Mine is running 19 and 21, however changign to 21 did not get around the build error so there must be more to is than that?
TIA
The issue is as a result of the compiledSdkVersion being set to 29, it needs to be set to 30
Each time you upgrade your pubspecs, or run a pub upgrade, you need to run flutter clean. And it should solved. Specific to the photo_manager.

package junit.framework does not exist api 28

For a project using api 27 the build was successful. After moving to api 28 I am getting the following error. Please could you let me know why this occurs in api 28 and how I should fix my project?
error: package junit.framework does not exist
error: cannot find symbol variable Assert
error: cannot find symbol variable Assert
error: cannot find symbol variable Assert
error: cannot find symbol variable Assert
error: cannot find symbol variable Assert
error: cannot find symbol variable Assert
error: cannot find symbol variable Assert
error: cannot find symbol variable Assert
According to Android API Differences Report, junit.framework package is removed since API 28.
You may need to declare the dependencies:
dependencies {
testImplementation 'junit:junit:4.12'
// or implementation 'junit:junit:4.12' when not in test environment
}

Cannot find symbol toArrayList() android react native and react-native-admob

Deps:
"native-base": "2.3.5",
"react": "16.0.0",
"react-native": "0.50.4",
"react-native-admob": "^2.0.0-beta.3",
After an update from RN 0.45 to 0.50 and RN-Admob from 1.3.2 to 2.0.0-beta.3
When trying to build with react-native run-android
/node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNAdMobInterstitialAdModule.java:117:
error: cannot find symbol
ArrayList list = nativeArray.toArrayList();
^ symbol: method toArrayList() location: variable nativeArray of type
ReadableNativeArray
/Users/dobre/Desktop/projects//node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNAdMobRewardedVideoAdModule.java:129:
error: cannot find symbol
ArrayList list = nativeArray.toArrayList();
^ symbol: method toArrayList() location: variable nativeArray of type
ReadableNativeArray
/Users/dobre/Desktop/projects//node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNPublisherBannerViewManager.java:252:
error: cannot find symbol
ArrayList list = nativeArray.toArrayList();
^ symbol: method toArrayList() location: variable nativeArray of type
ReadableNativeArray
/Users/dobre/Desktop/projects//node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNPublisherBannerViewManager.java:271:
error: cannot find symbol
ArrayList list = nativeArray.toArrayList();
^ symbol: method toArrayList() location: variable nativeArray of type
ReadableNativeArray
/Users/dobre/Desktop/projects//node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNAdMobBannerViewManager.java:223:
error: cannot find symbol
ArrayList list = nativeArray.toArrayList();
^ symbol: method toArrayList() location: variable nativeArray of type
ReadableNativeArray 5 errors
:react-native-admob:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':react-native-admob:compileReleaseJavaWithJavac'.
Compilation failed; see the compiler error output for details.
I tried also RN 0.51 and manual unlink and re-link but nothing worked.
I think your android project still have the old linking.
You should open your project in android studio and check your main activity class
Try to check your MainActivity first, and even if error occurs. Then i think you have to downgrade your react-native-admob version form v2.0.0 to v1.3.2. It will work definitely.
Because, there is some issue in v2.0.0 which is still beta. You can check more about this issue on github here, https://github.com/sbugert/react-native-admob/issues/231
After days of investigations and unlinking and re-linking I solved it with:
maven {
url "$rootDir/../node_modules/react-native/android"
}
in build.gradle file.
Old url was "$projectDir/../../node_modules/react-native/android"
So it was a gradle issue. When building it used to get old react-native android libs.
Update the file :- Build.gradle(react-native-admob)
//implementation 'com.google.android.gms:play-services-ads:+' // Comment this line
implementation 'com.google.android.gms:play-services-ads:19.7.0' // Add this line

Cannot resolve symbol (CyanogenMod system apps)

I am trying to build following CyanogenMod (can be found here) projects:
android_packages_apps_Contacts
android_packages_apps_ContactsCommon
android_packages_apps_Calendar
android_packages_providers_ContactsProvider
android_packages_providers_CalendarProvider
I'm using AndroidStudio. Downloaded and imported the projects.
Changing the Android SDK versions with no result.
The errors are as follows:
Error:(37, 33) java: package com.google.common.collect does not exist
Error:(23, 25) java: package com.android.vcard does not exist
Error:(134, 6) java: cannot find symbol
symbol: class VisibleForTesting
location: class com.android.contacts.common.util.SearchUtil
How can I build these projects? Do I need some other libriaries? Maybe I need to use CyanogenMod libriaries instead of Android SDK?
Here is the detailed info.

Categories

Resources