Я уже несколько дней возился с кодом и не могу заставить Gradle собрать для меня подписанный APK (следуя инструкциям по коду ошибки, вы получите успешную сборку, но мой API Календаря Google не работает).
dependencies {
// commented stuff is no longer used or commented for some other reason.
//compile 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
// Dont know whats up with these errors above. ^
// they seem to work even though they are "incompatible"
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.code.findbugs:jsr305:3.0.1'
implementation('com.google.api-client:google-api-client-android:1.23.0') {
exclude module: 'guava-jdk5'
//exclude group: 'org.apache.httpcomponents'
}
implementation 'com.android.support:multidex:1.0.3'
//implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.android.support:cardview-v7:28.0.0'
//implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.bartoszlipinski.constraint:staggeredanimationgroup:1.0.0'
implementation 'com.android.support:transition:28.0.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.3'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.2'
implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.1'
implementation 'com.google.firebase:firebase-core:16.0.3'
/*Make sure these are always updated to the newest versions.*/
implementation('com.google.oauth-client:google-oauth-client-jetty:1.23.0') {
exclude module: 'guava-jdk5'
}
implementation('com.google.apis:google-api-services-calendar:v3-rev305-1.23.0') {
exclude module: 'guava-jdk5'
}
//implementation 'pub.devrel:easypermissions:0.3.0'
implementation 'com.google.http-client:google-http-client-jackson:1.15.0-rc'
//implementation 'com.google.android.gms:play-services-auth:16.0.0'
Это мои зависимости от моих файлов Gradle.
Игнорировать ошибку на 'com.android.support:support-vector-drawable:28.0.0', потому что это нормально;Я просто не могу получить свой APK для сборки с подписью;и когда это принудительно, мой код Календаря Google не возвращает события.
Executing tasks: [:app:assembleRelease]
Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
:app:checkReleaseClasspath
:app:preBuild UP-TO-DATE
:app:preReleaseBuild
:app:compileReleaseAidl NO-SOURCE
:app:compileReleaseRenderscript UP-TO-DATE
:app:checkReleaseManifest UP-TO-DATE
:app:generateReleaseBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:mainApkListPersistenceRelease UP-TO-DATE
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources UP-TO-DATE
:app:processReleaseGoogleServices
Parsing json file: C:\Users\Dylan\Documents\ClarenceFultonSecondary\app\google-services.json
:app:mergeReleaseResources
:app:createReleaseCompatibleScreenManifests UP-TO-DATE
:app:processReleaseManifest
:app:splitsDiscoveryTaskRelease UP-TO-DATE
:app:processReleaseResources
:app:generateReleaseSources
:app:javaPreCompileRelease
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileReleaseJavaWithJavac
:app:compileReleaseNdk NO-SOURCE
:app:compileReleaseSources
C:\Users\Dylan\Documents\ClarenceFultonSecondary\app\build.gradle: Error: commons-logging defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar. [DuplicatePlatformClasses]
C:\Users\Dylan\Documents\ClarenceFultonSecondary\app\build.gradle: Error: httpclient defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar. [DuplicatePlatformClasses]
Explanation for issues of type "DuplicatePlatformClasses":
There are a number of libraries that duplicate not just functionality of
the Android platform but using the exact same class names as the ones
provided in Android -- for example the apache http classes. This can lead
to unexpected crashes.
To solve this, you need to either find a newer version of the library which
no longer has this problem, or to repackage the library (and all of its
dependencies) using something like the jarjar tool, or finally, rewriting
the code to use different APIs (for example, for http code, consider using
HttpUrlConnection or a library like okhttp).
2 errors, 0 warnings
:app:lintVitalRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.</p>
<blockquote>
<p>Lint found fatal errors while assembling a release target.
To proceed, either fix the issues identified by lint, or modify your build script as follows:
...
android {
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
...
* 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 <a href="https://help.gradle.org" rel="nofollow noreferrer">https://help.gradle.org</a>
BUILD FAILED in 31s
Это то, что говорится в моем отчете:
ДублироватьКлассы платформы
.. / .. / build.gradle: commons-logging определяет классы, которые конфликтуют с классами, теперь предоставляемыми Android.Решения включают в себя поиск более новых версий или альтернативных библиотек, которые не имеют такой же проблемы (например, для httpclient вместо этого используйте HttpUrlConnection или okhttp), или переупаковка библиотеки с использованием чего-то вроде jarjar.
.. / .. /build.gradle: httpclient определяет классы, которые конфликтуют с классами, теперь предоставляемыми Android.Решения включают в себя поиск более новых версий или альтернативных библиотек, у которых нет такой же проблемы (например, для httpclient вместо этого используйте HttpUrlConnection или okhttp), или переупаковка библиотеки с использованием чего-то вроде jarjar.