编译时CastCompanionLibrary-android错误代码138

时间:2014-02-14 12:08:44

标签: android chromecast

我已将CastCompanionLibrary-android设置为Android Studio(0.4.4)中的android库项目。我已将以下依赖项添加到build.gradle

compile 'com.android.support:appcompat-v7:19.0.+'
compile 'com.android.support:mediarouter-v7:19.0.+'
compile 'com.google.android.gms:play-services:4.2.+'

构建时我总是遇到这个错误。

     Execution failed for task ':castcompanion-lib:processDebugResources'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Applications/Android Studio.app/sdk/build-tools/android-4.4.2/aapt package -f --no-crunch -I /Applications/Android Studio.app/sdk/platforms/android-19/android.jar -M

    /Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/build/bundles/debug/AndroidManifest.xml -S 
    /Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/build/res/all/debug -A 
    /Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/build/bundles/debug/assets -m -J 
    /Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/build/source/r/debug -F
    /Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/build/libs/castcompanion-lib-debug.ap_ --debug-mode --non-constant-id --output-text-symbols /Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/build/bundles/debug
    Error Code: 138

非常感谢任何帮助。 感谢。

编辑:

将构建工具切换到18.1.1现在向我展示了与处理xml资源有关的一些不同错误。

要切换构建工具,我已将build.gradle修改为:

apply plugin: 'android-library'

android {
    compileSdkVersion 18
    buildToolsVersion "18.1.1"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 16
        versionCode 1
        versionName "1.0"
    }
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:19.0.+'
    compile 'com.android.support:mediarouter-v7:19.0.+'
    compile 'com.google.android.gms:play-services:4.2.+'
}

注意:minSdkVersion 9(如果它低于清除合并失败)。

此时它在资源xml文件中发现了2个错误... 为了解决这些错误,我将以下行添加到res / values / strings.xml

<string name="no_media_info">No media info</string>
<string name="media_route_menu_title">Media Router Title</string>

现在当我编译时,我得到了33个错误,所有这些都与资源处理有关......它的进展很多但仍然感觉我正在做一些可怕的错误......

为了完整性,这里是完整的gradle输出:

Executing tasks: [:castcompanion-lib:generateDebugSources, :chromecast-video:generateDebugSources]

Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
:castcompanion-lib:preBuild UP-TO-DATE
:castcompanion-lib:preDebugBuild UP-TO-DATE
:castcompanion-lib:preDebugTestBuild UP-TO-DATE
:castcompanion-lib:preReleaseBuild UP-TO-DATE
:castcompanion-lib:prepareComAndroidSupportAppcompatV71901Library UP-TO-DATE
:castcompanion-lib:prepareComAndroidSupportMediarouterV71901Library UP-TO-DATE
:castcompanion-lib:prepareComGoogleAndroidGmsPlayServices4242Library UP-TO-DATE
:castcompanion-lib:prepareDebugDependencies
:castcompanion-lib:compileDebugAidl UP-TO-DATE
:castcompanion-lib:compileDebugRenderscript UP-TO-DATE
:castcompanion-lib:generateDebugBuildConfig UP-TO-DATE
:castcompanion-lib:mergeDebugAssets UP-TO-DATE
:castcompanion-lib:mergeDebugResources
:castcompanion-lib:processDebugManifest UP-TO-DATE
:castcompanion-lib:processDebugResources
:castcompanion-lib:generateDebugSources
:chromecast-video:preBuild UP-TO-DATE
:chromecast-video:preDebugBuild UP-TO-DATE
:castcompanion-lib:compileReleaseNdk UP-TO-DATE
:castcompanion-lib:compileLint
:castcompanion-lib:copyReleaseLint UP-TO-DATE
:castcompanion-lib:mergeReleaseProguardFiles UP-TO-DATE
:castcompanion-lib:packageReleaseAidl UP-TO-DATE
:castcompanion-lib:prepareReleaseDependencies
:castcompanion-lib:compileReleaseAidl UP-TO-DATE
:castcompanion-lib:compileReleaseRenderscript UP-TO-DATE
:castcompanion-lib:generateReleaseBuildConfig UP-TO-DATE
:castcompanion-lib:mergeReleaseAssets UP-TO-DATE
:castcompanion-lib:mergeReleaseResources UP-TO-DATE
:castcompanion-lib:processReleaseManifest UP-TO-DATE
:castcompanion-lib:processReleaseResources UP-TO-DATE
:castcompanion-lib:generateReleaseSources UP-TO-DATE
:castcompanion-lib:compileReleaseJava/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/BaseCastManager.java:685: cannot find symbol
symbol  : variable session_reconnection_attempt
location: class com.google.sample.castcompanionlibrary.R.string
                    dlg.setMessage(context.getString(R.string.session_reconnection_attempt));
                                                             ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/BaseCastManager.java:895: cannot find symbol
symbol  : variable failed_to_connect
location: class com.google.sample.castcompanionlibrary.R.string
            Utils.showErrorDialog(mContext, R.string.failed_to_connect);
                                                    ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/widgets/MiniController.java:127: cannot find symbol
symbol  : variable failed_perform_action
location: class com.google.sample.castcompanionlibrary.R.string
                        listener.onFailed(R.string.failed_perform_action, -1);
                                                  ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/widgets/MiniController.java:129: cannot find symbol
symbol  : variable failed_no_connection_trans
location: class com.google.sample.castcompanionlibrary.R.string
                        listener.onFailed(R.string.failed_no_connection_trans, -1);
                                                  ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/widgets/MiniController.java:131: cannot find symbol
symbol  : variable failed_no_connection
location: class com.google.sample.castcompanionlibrary.R.string
                        listener.onFailed(R.string.failed_no_connection, -1);
                                                  ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/widgets/MiniController.java:147: cannot find symbol
symbol  : variable failed_perform_action
location: class com.google.sample.castcompanionlibrary.R.string
                        listener.onFailed(R.string.failed_perform_action, -1);
                                                  ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java:254: cannot find symbol
symbol  : variable casting_to_device
location: class com.google.sample.castcompanionlibrary.R.string
                    R.string.casting_to_device, mDeviceName));
                            ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java:541: cannot find symbol
symbol  : variable failed_setting_volume
location: class com.google.sample.castcompanionlibrary.R.string
                                onFailed(R.string.failed_setting_volume,
                                                 ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java:824: cannot find symbol
symbol  : variable failed_status_request
location: class com.google.sample.castcompanionlibrary.R.string
                                onFailed(R.string.failed_status_request,
                                                 ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java:840: cannot find symbol
symbol  : variable failed_no_connection_trans
location: class com.google.sample.castcompanionlibrary.R.string
            onFailed(R.string.failed_no_connection_trans, NO_STATUS_CODE);
                             ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java:843: cannot find symbol
symbol  : variable failed_no_connection
location: class com.google.sample.castcompanionlibrary.R.string
            onFailed(R.string.failed_no_connection, NO_STATUS_CODE);
                             ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java:900: cannot find symbol
symbol  : variable failed_to_find_app
location: class com.google.sample.castcompanionlibrary.R.string
                        Utils.showErrorDialog(mContext, R.string.failed_to_find_app);
                                                                ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java:904: cannot find symbol
symbol  : variable failed_app_launch_timeout
location: class com.google.sample.castcompanionlibrary.R.string
                        Utils.showErrorDialog(mContext, R.string.failed_app_launch_timeout);
                                                                ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java:909: cannot find symbol
symbol  : variable failed_to_launch_app
location: class com.google.sample.castcompanionlibrary.R.string
                        Utils.showErrorDialog(mContext, R.string.failed_to_launch_app);
                                                                ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java:970: cannot find symbol
symbol  : variable failed_load
location: class com.google.sample.castcompanionlibrary.R.string
                            onFailed(R.string.failed_load, result.getStatus().getStatusCode());
                                             ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java:1016: cannot find symbol
symbol  : variable failed_to_play
location: class com.google.sample.castcompanionlibrary.R.string
            throw new CastException(mContext.getString(R.string.failed_to_play), e);
                                                               ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java:1064: cannot find symbol
symbol  : variable failed_to_pause
location: class com.google.sample.castcompanionlibrary.R.string
            throw new CastException(mContext, R.string.failed_to_pause, e);
                                                      ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java:1093: cannot find symbol
symbol  : variable failed_seek
location: class com.google.sample.castcompanionlibrary.R.string
                            onFailed(R.string.failed_seek, result.getStatus().getStatusCode());
                                             ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java:1122: cannot find symbol
symbol  : variable failed_seek
location: class com.google.sample.castcompanionlibrary.R.string
                            onFailed(R.string.failed_seek, result.getStatus().getStatusCode());
                                             ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java:1394: cannot find symbol
symbol  : variable failed_receiver_player_error
location: class com.google.sample.castcompanionlibrary.R.string
                    onFailed(R.string.failed_receiver_player_error, NO_STATUS_CODE);
                                     ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/VideoCastManager.java:1600: cannot find symbol
symbol  : variable casting_to_device
location: class com.google.sample.castcompanionlibrary.R.string
                                    R.string.casting_to_device, getDeviceName()))
                                            ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/dialog/video/VideoMediaRouteControllerDialog.java:141: cannot find symbol
symbol  : variable failed_no_connection_short
location: class com.google.sample.castcompanionlibrary.R.string
            hideControls(true, R.string.failed_no_connection_short);
                                       ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/player/VideoCastControllerActivity.java:146: cannot find symbol
symbol  : variable failed_no_connection_trans
location: class com.google.sample.castcompanionlibrary.R.string
                            R.string.failed_no_connection_trans);
                                    ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/player/VideoCastControllerActivity.java:150: cannot find symbol
symbol  : variable failed_no_connection
location: class com.google.sample.castcompanionlibrary.R.string
                            R.string.failed_no_connection);
                                    ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/player/VideoCastControllerActivity.java:154: cannot find symbol
symbol  : variable failed_perform_action
location: class com.google.sample.castcompanionlibrary.R.string
                            R.string.failed_perform_action);
                                    ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/player/VideoCastControllerActivity.java:227: cannot find symbol
symbol  : variable casting_to_device
location: class com.google.sample.castcompanionlibrary.R.string
                mLine2.setText(getString(R.string.casting_to_device,
                                                 ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/player/VideoCastControllerActivity.java:237: cannot find symbol
symbol  : variable casting_to_device
location: class com.google.sample.castcompanionlibrary.R.string
                mLine2.setText(getString(R.string.casting_to_device,
                                                 ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/player/VideoCastControllerActivity.java:245: cannot find symbol
symbol  : variable casting_to_device
location: class com.google.sample.castcompanionlibrary.R.string
                mLine2.setText(getString(R.string.casting_to_device,
                                                 ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/player/VideoCastControllerActivity.java:251: cannot find symbol
symbol  : variable loading
location: class com.google.sample.castcompanionlibrary.R.string
                mLine2.setText(getString(R.string.loading));
                                                 ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/cast/player/VideoCastControllerActivity.java:403: cannot find symbol
symbol  : variable failed_setting_volume
location: class com.google.sample.castcompanionlibrary.R.string
                    R.string.failed_setting_volume);
                            ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/notification/VideoCastNotificationService.java:304: cannot find symbol
symbol  : variable casting_to_device
location: class com.google.sample.castcompanionlibrary.R.string
        String castingTo = getResources().getString(R.string.casting_to_device,
                                                            ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/utils/Utils.java:90: cannot find symbol
symbol  : variable ok
location: class com.google.sample.castcompanionlibrary.R.string
                .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                                           ^
/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/java/com/google/sample/castcompanionlibrary/utils/Utils.java:88: cannot find symbol
symbol  : variable error
location: class com.google.sample.castcompanionlibrary.R.string
        new AlertDialog.Builder(context).setTitle(R.string.error)
                                                          ^
33 errors
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':castcompanion-lib:compileReleaseJava'.
> 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.

BUILD FAILED

Total time: 26.581 secs

更新:

其实上面的错误是我自己的错,似乎当我在Android Studio中设置项目并允许Android Studio将自动生成的res文件夹与CastCompanionLibrary-android中的res文件夹合并时,它没有做覆盖,所以我最终得到了一些不正确的资源。

使用CastCompanionLibrary-android git repo中的原始文件替换坏res文件夹后,我现在收到有关重复资源的编译错误...

Execution failed for task ':castcompanion-lib:mergeReleaseResources'.
  

/Users/a/AndroidStudioProjects/ChromecastVideoTest/castcompanion-lib/src/main/res/values/styles_democast.xml:错误:重复资源:/ Users / a / AndroidStudioProjects / ChromecastVideoTest / castcompanion-lib / src / main / res / values / styles_democast.xml:style / TextAppearance.ShowcaseView.Detail.Light,/ Users / a / AndroidStudioProjects /ChromecastVideoTest /castcompanion-lib / src / main / res / values / styles_castvideo.xml:style / TextAppearance.ShowcaseView.Detail .Light

好吧,我们继续......

更新:

现在正在编译,基本上关闭了Android Studio并将res文件夹替换为CastCompanionLibrary-android中的原始res文件夹。

更新(项目设置):

我创建了一个新项目,然后创建了两个模块。一个用于CastCompanionLibrary-android的android库模块和一个用于CastVideos-android的android模块。我从原始的github项目中复制了src和res文件夹......这里的技巧是先关闭Android Studio然后再这样做。否则我认为Android Studio会尝试合并文件。 CastCompanion库的构建gradle在上面的帖子中......你可以安全地使用

compileSdkVersion 19, 
buildToolsVersion "19.0.1"

如果你愿意... 18似乎在处理资源失败方面给出了更好的错误。

CastVideos-android build.gradle是......

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.1'

    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile project(':castcompanion-lib')
    compile files('libs/android-query.0.25.10.jar')
}`

0 个答案:

没有答案