gpt4 book ai didi

java - AndroidX 任务 :@react-native-community_viewpager:compileDebugJavaWithJavac FAILED 之后的 React-Native

转载 作者:行者123 更新时间:2023-12-02 04:09:17 26 4
gpt4 key购买 nike

在 RN 模块中更新 AndroidX 后(在当前示例中 @react-native-async-storage/viewpager)编译失败。找不到符号和方法。

我添加了,但没有帮助:

android.useAndroidX = true android.enableJetifier = true

我尝试过降级模块并重新安装。项目未编译。

Gradle 版本 - 4.10.1
"react-native": "^0.59.9"
“@react-native-community/viewpager”:“^1.1.7”

Task :@react-native-community_viewpager:compileDebugJavaWithJavac FAILED
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:10: error: package android.support.v4.view does not exist
import android.support.v4.view.PagerAdapter;
^
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:11: error: package android.support.v4.view does not exist
import android.support.v4.view.ViewPager;
^
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:29: error: cannot find symbol
public class ReactViewPager extends ViewPager {
^
symbol: class ViewPager
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:31: error: cannot find symbol
private class Adapter extends PagerAdapter {
^
symbol: class PagerAdapter
location: class ReactViewPager
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:64: error: cannot find symbol
void removeAllViewsFromAdapter(ViewPager pager) {
^
symbol: class ViewPager
location: class ReactViewPager.Adapter
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:107: error: package ViewPager does not exist
private class PageChangeListener implements ViewPager.OnPageChangeListener {
^
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPagerManager.java:27: error: type argument ReactViewPager is not within bounds of type-variable T
public class ReactViewPagerManager extends ViewGroupManager<ReactViewPager> {
^
where T is a type-variable:
T extends ViewGroup declared in class ViewGroupManager
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPagerManager.java:117: error: cannot find symbol
pager.setPageMargin((int) PixelUtil.toPixelFromDIP(margin));
^
symbol: method setPageMargin(int)
location: variable pager of type ReactViewPager
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPagerManager.java:122: error: cannot find symbol
pager.setClipToPadding(!peekEnabled);
^
symbol: method setClipToPadding(boolean)
location: variable pager of type ReactViewPager
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:38: error: cannot find symbol
notifyDataSetChanged();
^
symbol: method notifyDataSetChanged()
location: class ReactViewPager.Adapter
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:43: error: cannot find symbol
notifyDataSetChanged();
^
symbol: method notifyDataSetChanged()
location: class ReactViewPager.Adapter
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:52: error: cannot find symbol
notifyDataSetChanged();
^
symbol: method notifyDataSetChanged()
location: class ReactViewPager.Adapter
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:76: error: method does not override or implement a method from a supertype
@Override
^
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:81: error: method does not override or implement a method from a supertype
@Override
^
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:85: error: cannot find symbol
POSITION_NONE : mViews.indexOf(object);
^
symbol: variable POSITION_NONE
location: class ReactViewPager.Adapter
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:88: error: method does not override or implement a method from a supertype
@Override
^
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:91: error: cannot find symbol
container.addView(view, 0, generateDefaultLayoutParams());
^
symbol: method generateDefaultLayoutParams()
location: class ReactViewPager.Adapter
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:92: error: cannot find symbol
post(measureAndLayout);
^
symbol: method post(Runnable)
location: class ReactViewPager.Adapter
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:96: error: method does not override or implement a method from a supertype
@Override
^
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:101: error: method does not override or implement a method from a supertype
@Override
^
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:109: error: method does not override or implement a method from a supertype
@Override
^
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:112: error: cannot find symbol
new PageScrollEvent(getId(), position, positionOffset));
^
symbol: method getId()
location: class ReactViewPager.PageChangeListener
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:115: error: method does not override or implement a method from a supertype
@Override
^
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:119: error: cannot find symbol
new PageSelectedEvent(getId(), position));
^
symbol: method getId()
location: class ReactViewPager.PageChangeListener
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:123: error: method does not override or implement a method from a supertype
@Override
^
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:127: error: cannot find symbol
case SCROLL_STATE_IDLE:
^
symbol: variable SCROLL_STATE_IDLE
location: class ReactViewPager.PageChangeListener
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:130: error: cannot find symbol
case SCROLL_STATE_DRAGGING:
^
symbol: variable SCROLL_STATE_DRAGGING
location: class ReactViewPager.PageChangeListener
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:133: error: cannot find symbol
case SCROLL_STATE_SETTLING:
^
symbol: variable SCROLL_STATE_SETTLING
location: class ReactViewPager.PageChangeListener
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:140: error: cannot find symbol
new PageScrollStateChangedEvent(getId(), pageScrollState));
^
symbol: method getId()
location: class ReactViewPager.PageChangeListener
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:152: error: cannot find symbol
setOnPageChangeListener(new PageChangeListener());
^
symbol: method setOnPageChangeListener(ReactViewPager.PageChangeListener)
location: class ReactViewPager
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:153: error: cannot find symbol
setAdapter(new Adapter());
^
symbol: method setAdapter(ReactViewPager.Adapter)
location: class ReactViewPager
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:156: error: method does not override or implement a method from a supertype
@Override
^
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:158: error: cannot find symbol
return (Adapter) super.getAdapter();
^
symbol: variable super
location: class ReactViewPager
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:161: error: method does not override or implement a method from a supertype
@Override
^
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:168: error: cannot find symbol
if (super.onInterceptTouchEvent(ev)) {
^
symbol: variable super
location: class ReactViewPager
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:169: error: incompatible types: ReactViewPager cannot be converted to View
NativeGestureUtil.notifyNativeGestureStarted(this, ev);
^
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:182: error: method does not override or implement a method from a supertype
@Override
^
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:189: error: cannot find symbol
return super.onTouchEvent(ev);
^
symbol: variable super
location: class ReactViewPager
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:202: error: cannot find symbol
setCurrentItem(item, animated);
^
symbol: method setCurrentItem(int,boolean)
location: class ReactViewPager
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:211: error: method does not override or implement a method from a supertype
@Override
^
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:213: error: cannot find symbol
super.onAttachedToWindow();
^
symbol: variable super
location: class ReactViewPager
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:216: error: cannot find symbol
this.requestLayout();
^
symbol: method requestLayout()
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:217: error: cannot find symbol
post(measureAndLayout);
^
symbol: method post(Runnable)
location: class ReactViewPager
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:224: error: cannot find symbol
MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.EXACTLY),
^
symbol: method getWidth()
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:224: error: cannot find symbol
MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.EXACTLY),
^
symbol: variable MeasureSpec
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:224: error: cannot find symbol
MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.EXACTLY),
^
symbol: variable MeasureSpec
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:225: error: cannot find symbol
MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.EXACTLY));
^
symbol: method getHeight()
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:225: error: cannot find symbol
MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.EXACTLY));
^
symbol: variable MeasureSpec
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:225: error: cannot find symbol
MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.EXACTLY));
^
symbol: variable MeasureSpec
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:226: error: cannot find symbol
layout(getLeft(), getTop(), getRight(), getBottom());
^
symbol: method getLeft()
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:226: error: cannot find symbol
layout(getLeft(), getTop(), getRight(), getBottom());
^
symbol: method getTop()
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:226: error: cannot find symbol
layout(getLeft(), getTop(), getRight(), getBottom());
^
symbol: method getRight()
/Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPager.java:226: error: cannot find symbol
layout(getLeft(), getTop(), getRight(), getBottom());
^
symbol: method getBottom()
Note: /Users/mama/mobile/node_modules/@react-native-community/viewpager/android/src/main/java/com/reactnativecommunity/viewpager/ReactViewPagerManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
53 errors


FAILURE: Build failed with an exception.

* What went wrong:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
>**Execution failed for task ':@react-native-community_viewpager:compileDebugJavaWithJavac'.**
See https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:command_line_warnings
21 actionable tasks: 1 executed, 20 up-to-date
> 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 15s
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

最佳答案

  • npm 我喷射器
  • npx jetify

如果问题仍然存在,请在模块级 build.gradle 文件的默认配置中设置以下内容
multiDexEnabled true

关于java - AndroidX 任务 :@react-native-community_viewpager:compileDebugJavaWithJavac FAILED 之后的 React-Native,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56699021/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com