package junit.framework does not exist api 28 - android

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
}

Related

Import issues updating to exoplayer 2.18.2

I have updated exoplayer and the exoplayer-extension-ima version from 2.11.1 to the latest one (2.18.2).
Checking the release notes I just saw this on the version 2.18.1 section:
This release corresponds to the AndroidX media3 1.0.0-beta02 release.
So I thought I had to upgrade my exoplayer imports from com.google.android.exoplayer2 to androidx.media3 and I followed this migration guide downloading the script for the 2.18.2 version and changing the LEGACY_PEER_VERSION variable from 2.18.1 to 2.18.2 and executing it withot getting any relevant error.
However after running the assembleRelease gradle script I'm facing the next errors:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'extension-level'. One of '{layoutlib}' is expected.
cvc-complex-type.2.4.d: Invalid content was found starting with element 'extension-level'. No child element is expected at this point.
cvc-complex-type.2.4.a: Invalid content was found starting with element 'base-extension'. One of '{codename, tag}' is expected.
:myproject.exoplayer:compileReleaseJavaWithJavac
ExoPlayerListener.java
package com.google.android.exoplayer2.ext.ima does not exist
cannot find symbol class TrackGroupArray
package com.google.android.exoplayer2.trackselection does not exist
cannot find symbol class DefaultEventListener
cannot find symbol class ImaAdsLoader
cannot find symbol class ImaAdsLoader
cannot find symbol class TrackGroupArray
cannot find symbol class TrackSelectionArray
cannot find symbol class ImaAdsLoader
method does not override or implement a method from a supertype
method does not override or implement a method from a supertype
method does not override or implement a method from a supertype
method does not override or implement a method from a supertype
cannot find symbol variable super
On my ExoplayerListener.java some exoplayer imports changed (placing the mouse over them displays a Cannot resolve symbol 'media3' error)
import androidx.media3.common.Player;
import androidx.media3.common.TrackGroupArray;
And some don't (placing the mouse over them displays a Cannot resolve symbol 'android' error)
import com.google.android.exoplayer2.ext.ima.ImaAdsLoader;
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
Am I doing something wrong, or is it perhaps that my steps towards the migration aren't correct?
Mention that I haven't changed anything on the code, just changing the below imports on the build.gradle file from:
api 'com.google.android.exoplayer:exoplayer:2.11.1'
api 'com.google.android.exoplayer:extension-ima:2.11.1'
to:
api 'com.google.android.exoplayer:exoplayer:2.18.2'
api 'com.google.android.exoplayer:extension-ima:2.18.2'
And after the migration script changed to:
api 'androidx.media3:media3-exoplayer:1.0.0-beta03'
api 'androidx.media3:media3-exoplayer-ima:1.0.0-beta03'

Getting exception in build, when adding file_picker package

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
}

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 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

Android cannot resolve play-services symbols

When trying to compile, I get the following errors:
Error:(59, 13) error: cannot find symbol class InstanceID
Error:(59, 37) error: cannot find symbol variable InstanceID
Error:(60, 59) error: package R does not exist
Error:(61, 21) error: cannot find symbol variable GoogleCloudMessaging
Error:(88, 9) error: cannot find symbol variable LocalBroadcastManager
Error:(117, 9) error: cannot find symbol class GcmPubSub
Error:(117, 28) error: cannot find symbol variable GcmPubSub
This is in a module, which is compiled as dependent on play-services:
com.google.android.gms:play-services:7.8.0 compile
I have tried cleaning and building, invalidating the cache and restarting. What am I missing here? Why can't it find the play-services library?

Categories

Resources