我在单个android项目中创建了两个模块,命名为x和y.
现在我想在Egg类中导入类Foo,为此我在类Egg中编写了下面提到的语句
Import com.example.y.Foo;
Run Code Online (Sandbox Code Playgroud)
现在,Foo不被android识别.
问题,
是否可以仅使用import语句从其他模块导入Class?
我是否需要创建模块y的库,然后将创建的库导入模块x?
或者解决方案可能是别的.
由于SDK Manager中提供了Android 6.0的新API,因此在应用程序级build.gradle文件中出现了一个提示以进行更新
从
androidTestCompile 'com.android.support:support-annotations:22.0.1'
compile 'com.android.support:appcompat-v7:22.0.1'
Run Code Online (Sandbox Code Playgroud)
至
androidTestCompile 'com.android.support:support-annotations:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.0'
Run Code Online (Sandbox Code Playgroud)
我还没有从Android 6(API 23)的sdk管理器下载新的更新,但仍然更改了以下详细信息,如下所示,
之前
compileSdkVersion 22
buildToolsVersion "22.0.1"
targetSdkVersion 22
androidTestCompile 'com.android.support:support-annotations:22.0.1'
compile 'com.android.support:appcompat-v7:22.0.1'
Run Code Online (Sandbox Code Playgroud)
后
compileSdkVersion 23
buildToolsVersion "23.0.0"
targetSdkVersion 23
androidTestCompile 'com.android.support:support-annotations:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.0'
Run Code Online (Sandbox Code Playgroud)
由于我尚未下载新的API 6.0,因此发生以下错误
Error:Cause: failed to find target with hash string 'android-23' in: C:\Users\DRONE\AppData\Local\Android\sdk
Run Code Online (Sandbox Code Playgroud)
所以我现在再次将应用程序级build.gradle文件中的设置更改为之前的设置,但错误未得到解决.发生了同样的错误.
我现在该怎么解决这个问题?
我正在尝试一个实现Google Cloud Messaging(GCM)的示例代码,该代码由Google本身提供,即GCM Demo.
我不知道我究竟能添加依赖项
dependencies android gradle google-cloud-messaging android-studio