0

我创建了一个包含一些活动和事务逻辑的库模块,这些模块将被不同的现有应用程序进一步使用。库模块使用androidx,但我现有的项目不使用 androidx。我也不想搞砸我现有的项目。

向项目添加了模块依赖项

 implementation project(':abcdSDKModule')

导入库模块后,我遇到了很多错误,例如

e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\XXXX-android\app\src\main\java\com\abc\mmp\utils\view\PinEntryEditText.java:71: 
error: cannot find symbol
protected OnClickListener mClickListener;
          ^
symbol:   class OnClickListener
location: class PinEntryEditText
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\abc\mmp\utils\view\PinEntryEditText.java:280: error: cannot find symbol
public void setOnClickListener(OnClickListener l) {
                               ^
symbol:   class OnClickListener
location: class PinEntryEditText
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\xxxx\pinLib\PinCompatActivity.java:20: error: cannot find symbol
public class PinCompatActivity extends AppCompatActivity {
                                   ^
symbol: class AppCompatActivity
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\xxxx\mmp\pinLib\PinFragmentActivity.java:20: error: cannot find symbol
public class PinFragmentActivity extends FragmentActivity {
                                     ^
symbol: class FragmentActivity
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\xxxx\mmp\pinLib\views\PinActionBarActivity.java:14: error: cannot find symbol
public class PinActionBarActivity extends AppCompatActivity {
                                      ^
symbol: class AppCompatActivity
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\xxxx\mmp\test.java:8: error: cannot find symbol
public class test extends AppCompatActivity {
                      ^
symbol: class AppCompatActivity
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\xxxx\mmp\utils\DividerItemDecorator.java:49: error: cannot find symbol
public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
                                                    ^
symbol:   class RecyclerView
location: class DividerItemDecorator
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\xxxx\mmp\utils\DividerItemDecorator.java:67: error: cannot find symbol
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
                                 ^
symbol:   class RecyclerView
location: class DividerItemDecorator
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\xxxx\mmp\utils\DividerItemDecorator.java:119: error: cannot find symbol
private int getOrientation(RecyclerView parent) {
                           ^
symbol:   class RecyclerView
location: class DividerItemDecorator
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\xxxx\mmp\utils\EndlessRecyclerScrollListener.java:27: error: cannot find symbol
public EndlessRecyclerScrollListener(LinearLayoutManager layoutManager) {
                                     ^
symbol:   class LinearLayoutManager
location: class EndlessRecyclerScrollListener
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\EndlessRecyclerScrollListener.java:31: error: cannot find symbol
public EndlessRecyclerScrollListener(GridLayoutManager layoutManager) {
                                     ^
symbol:   class GridLayoutManager
location: class EndlessRecyclerScrollListener
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\EndlessRecyclerScrollListener.java:36: error: cannot find symbol
public EndlessRecyclerScrollListener(StaggeredGridLayoutManager layoutManager) {
                                     ^
symbol:   class StaggeredGridLayoutManager
location: class EndlessRecyclerScrollListener
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\EndlessRecyclerScrollListener.java:58: error: cannot find symbol
public void onScrolled(RecyclerView view, int dx, int dy) {
                       ^
symbol:   class RecyclerView
location: class EndlessRecyclerScrollListener
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\EndlessRecyclerScrollListener.java:108: error: cannot find symbol
public abstract void onLoadMore(int page, int totalItemsCount, RecyclerView view);
                                                               ^
symbol:   class RecyclerView
location: class EndlessRecyclerScrollListener
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\GridDividerDecoration.java:29: error: cannot find symbol
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
                                 ^
symbol:   class RecyclerView
location: class GridDividerDecoration
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\GridDividerDecoration.java:37: error: cannot find symbol
public void drawVertical(Canvas c, RecyclerView parent) {
                                   ^
symbol:   class RecyclerView
location: class GridDividerDecoration
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\GridDividerDecoration.java:59: error: cannot find symbol
public void drawHorizontal(Canvas c, RecyclerView parent) {
                                     ^
symbol:   class RecyclerView
location: class GridDividerDecoration
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\GridDividerDecoration.java:77: error: cannot find symbol
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
                                                    ^
symbol:   class RecyclerView
location: class GridDividerDecoration
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\OverscrollScalingViewAppBarLayoutBehavior.java:55: error: cannot find symbol
public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
                               ^
symbol:   class CoordinatorLayout
location: class OverscrollScalingViewAppBarLayoutBehavior
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\OverscrollScalingViewAppBarLayoutBehavior.java:60: error: cannot find symbol
public boolean onLayoutChild(CoordinatorLayout parent, View abl, int layoutDirection) {
                             ^
symbol:   class CoordinatorLayout
location: class OverscrollScalingViewAppBarLayoutBehavior
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\OverscrollScalingViewAppBarLayoutBehavior.java:73: error: cannot find symbol
public void onNestedScroll(CoordinatorLayout coordinatorLayout, View child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
                           ^
symbol:   class CoordinatorLayout
location: class OverscrollScalingViewAppBarLayoutBehavior
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\OverscrollScalingViewAppBarLayoutBehavior.java:96: error: cannot find symbol
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, View child, View directTargetChild, View target, int nestedScrollAxes) {
                                   ^
symbol:   class CoordinatorLayout
location: class OverscrollScalingViewAppBarLayoutBehavior
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\OverscrollScalingViewAppBarLayoutBehavior.java:101: error: cannot find symbol
public void onStopNestedScroll(CoordinatorLayout coordinatorLayout, View child, View target) {
                               ^
symbol:   class CoordinatorLayout
location: class OverscrollScalingViewAppBarLayoutBehavior
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\OverscrollScalingViewAppBarLayoutBehavior.java:111: error: cannot find symbol
    private ViewPropertyAnimatorListener mShouldRestoreListener = new ViewPropertyAnimatorListenerAdapter() {
            ^
symbol:   class ViewPropertyAnimatorListener
location: class OverscrollScalingViewAppBarLayoutBehavior.ViewScaler
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\OverscrollScalingViewAppBarLayoutBehavior.java:117: error: cannot find symbol
    private ViewPropertyAnimatorCompat mScaleAnimator;
            ^
symbol:   class ViewPropertyAnimatorCompat
location: class OverscrollScalingViewAppBarLayoutBehavior.ViewScaler
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\view\CalendarView.java:54: error: cannot find symbol
private RecyclerView grid;
        ^
symbol:   class RecyclerView
location: class CalendarView
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\view\PinEntryEditText2.java:34: error: cannot find symbol
private OnClickListener mClickListener;
        ^
symbol:   class OnClickListener
location: class PinEntryEditText2
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\view\PinEntryEditText2.java:133: error: cannot find symbol
public void setOnClickListener(OnClickListener l) {
                               ^
symbol:   class OnClickListener
location: class PinEntryEditText2
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\view\TouchImageView.java:97: error: cannot find symbol
private ScaleType mScaleType;
        ^
symbol:   class ScaleType
location: class TouchImageView
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\view\TouchImageView.java:117: error: cannot find symbol
private OnTouchListener userTouchListener = null;
        ^
symbol:   class OnTouchListener
location: class TouchImageView
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\view\TouchImageView.java:159: error: cannot find symbol
public void setOnTouchListener(OnTouchListener l) {
                               ^
symbol:   class OnTouchListener
location: class TouchImageView
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\view\TouchImageView.java:200: error: cannot find symbol
public void setScaleType(ScaleType type) {
                         ^
symbol:   class ScaleType
location: class TouchImageView
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\view\TouchImageView.java:220: error: cannot find symbol
public ScaleType getScaleType() {
       ^
symbol:   class ScaleType
location: class TouchImageView
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\view\TouchImageView.java:406: error: cannot find symbol
public void setZoom(float scale, float focusX, float focusY, ScaleType scaleType) {
                                                             ^
symbol:   class ScaleType
location: class TouchImageView
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\view\TouchImageView.java:1293: error: cannot find symbol
    public ScaleType scaleType;
           ^
symbol:   class ScaleType
location: class TouchImageView.ZoomVariables
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\-android\app\src\main\java\com\mta\mmp\utils\view\TouchImageView.java:1295: error: cannot find symbol
    public ZoomVariables(float scale, float focusX, float focusY, ScaleType scaleType) {
                                                                  ^
symbol:   class ScaleType
location: class TouchImageView.ZoomVariables
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\utils\view\TouchImageView.java:844: error: cannot find symbol
private class PrivateOnTouchListener implements OnTouchListener {
                                                ^
symbol:   class OnTouchListener
location: class TouchImageView
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\views\mcoupon\EndlessRecyclerScrollListner.java:27: error: cannot find symbol
public EndlessRecyclerScrollListner(LinearLayoutManager layoutManager) {
                                    ^
symbol:   class LinearLayoutManager
location: class EndlessRecyclerScrollListner
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\views\mcoupon\EndlessRecyclerScrollListner.java:31: error: cannot find symbol
public EndlessRecyclerScrollListner(GridLayoutManager layoutManager) {
                                    ^
symbol:   class GridLayoutManager
location: class EndlessRecyclerScrollListner
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\views\mcoupon\EndlessRecyclerScrollListner.java:36: error: cannot find symbol
public EndlessRecyclerScrollListner(StaggeredGridLayoutManager layoutManager) {
                                    ^
symbol:   class StaggeredGridLayoutManager
location: class EndlessRecyclerScrollListner
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\views\mcoupon\EndlessRecyclerScrollListner.java:57: error: cannot find symbol
public void onScrolled(RecyclerView view, int dx, int dy) {
                       ^
symbol:   class RecyclerView
location: class EndlessRecyclerScrollListner
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\views\mcoupon\EndlessRecyclerScrollListner.java:107: error: cannot find symbol
public abstract void onLoadMore(int page, int totalItemsCount, RecyclerView view);
                                                               ^
symbol:   class RecyclerView
location: class EndlessRecyclerScrollListner
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\pinLib\managers\AppLockActivity.java:333: error: cannot find symbol
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
                                                                  ^
symbol:   class Nullable
location: class AppLockActivity
e: C:\Users\Dell\AndroidStudioProjects\OfficeProject\xxxx-android\app\src\main\java\com\mta\mmp\pinLib\managers\AppLockActivity.java:367: error: cannot find symbol
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
                                                         ^



:app:kaptDebugKotlin FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
> Compilation error. See log for more details

我错过了什么?有些地方我发现了这个并尝试构建 gradle 但没有积极的结果

    configurations.all {
    resolutionStrategy {
        force 'androidx.media:media:1.0.0'
    }
}

我还在 gradle.properties 中添加了这些

android.useAndroidX=true
android.enableJetifier=true
4

1 回答 1

0

Android studio->项目结构->app->依赖项->添加模块

于 2019-03-13T09:32:14.313 回答