我正在使用AS 3.1,试图成为一名优秀的程序员并清除"编译已过时"的警告.但是我希望这个特殊的.jar将Guava暴露为API.其他项目(例如CloudServerApplication)也需要Guava.但是,当我使用api关键字而不是compile或implementation,我得到这个:
>gradlew FrameManager:build
> Configure project :CloudServerApplication
4.4
> Configure project :FrameManager
4.4
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\FrameManager\app\build.gradle' line: 16
* What went wrong:
A problem occurred evaluating project ':FrameManager'.
> Could not find method api() for arguments [com.google.guava:guava:14+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Run Code Online (Sandbox Code Playgroud)
我试过谷歌搜索错误,但没有找到任何有用的东西.不确定下一步该去哪儿.
我的build.gradle:
apply plugin: 'java'
println GradleVersion.current().getVersion()
repositories {
jcenter()
}
dependencies {
implementation 'org.json:json:20160212'
api 'com.google.guava:guava:14+' //<-- This used to be "compile" …Run Code Online (Sandbox Code Playgroud) 我的Android应用通过Google Analytics for Firebase收集数据.出于隐私原因,用户必须能够从Firebase服务器上擦除其数据,如果他们选择这样做的话.
该应用通过将其Firebase转发APP_INSTANCE_ID到我自己的服务器来请求删除.此服务器已预先准备好我的个人Google帐户(通过oauth2)的凭据,用于管理Firebase项目.服务器使用www.googleapis.com,并使用提供的身份验证APP_INSTANCE_ID调用upsert.
如文档所述,通用Google AnalyticsAPI适用于此任务.
在一些初始问题(b/c我没有正确的auth范围,并且未正确启用Analytics API)之后,googleapis.com现在为每个upsert请求返回HTTP 200.(顺便APP_INSTANCE_ID说一句,即使你提供虚假,它也会返回200.)
这是来自upsert的示例响应,它没有显示任何错误:
{ kind: 'analytics#userDeletionRequest',
id:
{ type: 'APP_INSTANCE_ID',
userId: (REDACTED 32-char hexidecimal string) },
firebaseProjectId: (REDACTED),
deletionRequestTime: '2018-08-28T12:46:30.874Z' }
Run Code Online (Sandbox Code Playgroud)
我知道这firebaseProjectId是正确的,因为如果我改变它,我会收到错误.我已经验证了它APP_INSTANCE_ID是正确的,并且一直稳定到重置之前resetAnalyticsData().
为了测试删除,我使用以下程序填充了Firebase的几个自定义事件(Nexus 5X模拟器,没有Google Play,没有配置Google帐户,但这不应该有任何区别):
FirebaseAnalytics.logEvent)FirebaseAnalytics.resetAnalyticsData(清除设备上缓存的任何事件数据)但是,即使24小时后,事件表中仍然存在100%的Firebase事件.由于upserts,Firebase服务器上没有发生可辨别的状态更改.
那么,我做错了什么?如何从Google Analytics for Firebase成功删除用户数据?
编辑
这是我用来发出请求的代码(来自node.js):
const request = require( 'request' );
... …Run Code Online (Sandbox Code Playgroud) 该代码对于低于 API28 的设备运行良好,对于高于或 Api28 的设备则失败。调试器不会显示引发错误的代码部分。
抛出错误的部分是在网络浏览器和视频播放器的意图期间。
我已经尝试过所有低于 API28 的 Android 设备,并且代码工作得很好。
hRecycler.read.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Toast.makeText(context,url,Toast.LENGTH_SHORT).show();
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
context.startActivity(i);
}
});
@Override
public void onSuccess(VimeoVideo video) {
String streamlink = (String)video.getStreams().values().toArray()[0];
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
Uri data = Uri.parse(streamlink);
intent.setDataAndType(data, "video/mp4");
context.startActivity(intent);
}
@Override
public void onFailure(Throwable throwable) {
Toast.makeText(context,"Problem withlink",Toast.LENGTH_SHORT).show();
}
RemoteException occurs on reporting focusChanged, w=Window{bd21bfc u0 com.example.android.play_api/com.example.android.play_api.TestimonyActivity EXITING} android.os.DeadObjectException
android.os.DeadObjectException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:1143)
at …Run Code Online (Sandbox Code Playgroud) 我创建了一个服务,用于查找用户的坐标并将其存储在 SQLite 数据库中。
public class GPS_Service extends Service {
DatabaseHelper myDb;
private LocationListener locationListener;
private LocationManager locationManager;
private String latitude, longitude;
@Override
public void onCreate() {
super.onCreate();
myDb = new DatabaseHelper(this);
}
@SuppressLint("MissingPermission")
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this,0, notificationIntent, 0);
Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID)
.setContentTitle("Service")
.setContentText("Coordinates Location Running")
.setContentIntent(pendingIntent)
.build();
startForeground(1, notification);
locationListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) { …Run Code Online (Sandbox Code Playgroud)