I am trying to run my code in studio but continuously getting this error :-
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithInstantRunForDebug'.
> Unexpected constructor structure.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I tried a lot many approaches to solve this error but nothing seems to be working for me
Here is what was doing earlier in my code when this error initially arise :-
Fragment Call from FragmentActivity:-
public void showSelectVideoFragment() {
// TODO Auto-generated method stub
if (checkCurrentSelectedBtForLeftMenu(lMenuBtUploadVideoWRAP)) {
return;
}
setBtBackgroundForLeftMenu(lMenuBtUploadVideoWRAP);
addFragment(new SVideoFragment(mLeftMenu));
}
private void addFragment(Fragment fragment) {
if (fragmentManager != null) {
if (fragmentManager.getBackStackEntryCount() == 0) {
PVHomeFragment homeFragment = (PVHomeFragment) fragmentManager
.findFragmentByTag(FM_TAG_HOME_FRAGMENT);
fragmentManager.beginTransaction().hide(homeFragment).commit();
} else {
fragmentManager.popBackStack();
}
fragmentManager.beginTransaction()
.add(R.id.fragmentContainer, fragment, FM_TAG_TOP_FRAGMENT)
.addToBackStack(null).commit();
}
}
SVideoFragment Code :-
public class SVideoFragment extends PVBaseFragment {
private SlidingMenu mLeftMenu = null;
private static final String SLIDEMENU_KEY = "describable_key";
public SVideoFragment() {
}
@SuppressLint({"NewApi","ValidFragment"})
public SVideoFragment(SlidingMenu leftMenu) {
mLeftMenu = leftMenu;
}
@Override
protected void initFragment() {
// TODO Auto-generated method stub
}
@SuppressLint({"NewApi","ValidFragment"})
@Override
protected View initFragmentView(LayoutInflater inflater, ViewGroup container) {
// TODO Auto-generated method stub
View v = inflater.inflate(R.layout.fragment_select_video, container,
false);
Button btToggleLeftMenu = (Button) v
.findViewById(R.id.btToggleLeftMenu);
btToggleLeftMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
if (mLeftMenu != null) {
mLeftMenu.toggle();
}
}
});
((Button) v.findViewById(R.id.btSelectVideo))
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
showVideoSelector();
}
});
return v;
}
I added below lines to build.gradle :-
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.app"
minSdkVersion 14
targetSdkVersion 22
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
lintOptions {
abortOnError false
checkReleaseBuilds false
}
dexOptions {
javaMaxHeapSize "4g" //specify the heap size for the dex process
preDexLibraries = false //delete the already predexed libraries
}
allprojects {
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
}
}
dependencies {
compile project(':sdk')
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile project(':android-3.1')
compile project(':AVIOCtrlDefine')
compile project(':Facebook')
compile project(':SlidingMenu-master')
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
}
android.packagingOptions {
exclude 'the META-INF / DEPENDENCIES'
exclude 'the META-INF / LICENSE'
exclude 'the META-INF / LICENSE.txt'
exclude 'the META-INF / license.txt'
exclude 'the META-INF / NOTICE'
exclude 'the META-INF / the NOTICE.txt '
exclude ' the META-INF / NOTICE.txt '
exclude ' the META-INF / ASL2.0 '
exclude ' the META-INF / Services / javax.annotation.processing.Processor '
}
After doing all above i was still getting same error so i choose second method that is :-
I called Fragment like this :-
public void showSelectVideoFragment() {
SVideoFragment mSVideoFragment = new SVideoFragment();
// TODO Auto-generated method stub
if (checkCurrentSelectedBtForLeftMenu(lMenuBtUploadVideoWRAP)) {
return;
}
setBtBackgroundForLeftMenu(lMenuBtUploadVideoWRAP);
addFragment(mSVideoFragment.newInstance(mLeftMenu));
}
And In Fragment :-
public class SVideoFragment extends PVBaseFragment {
private SlidingMenu mLeftMenu = null;
private static final String SLIDEMENU_KEY = "describable_key";
public SVideoFragment() {
}
public static SVideoFragment newInstance(SlidingMenu leftMenu) {
SVideoFragment fragment = new SVideoFragment();
Bundle bundle = new Bundle();
bundle.putSerializable(SLIDEMENU_KEY, leftMenu);
fragment.setArguments(bundle);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mLeftMenu = (SlidingMenu) getArguments().getSerializable(SLIDEMENU_KEY);
}
}
@Override
protected void initFragment() {
// TODO Auto-generated method stub
}
@SuppressLint({"NewApi","ValidFragment"})
@Override
protected View initFragmentView(LayoutInflater inflater, ViewGroup container) {
// TODO Auto-generated method stub
View v = inflater.inflate(R.layout.fragment_select_video, container,
false);
Button btToggleLeftMenu = (Button) v
.findViewById(R.id.btToggleLeftMenu);
btToggleLeftMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
if (mLeftMenu != null) {
mLeftMenu.toggle();
}
}
});
((Button) v.findViewById(R.id.btSelectVideo))
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
showVideoSelector();
}
});
return v;
}
But still i am getting same error
** when i run ./gradlew assembleDebug in terminal i got :-**
- What went wrong: Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 1
Here is my app Dependencies :-
+--- project :sdk +--- com.google.android.gms:play-services-ads:8.4.0 | --- com.google.android.gms:play-services-basement:8.4.0 | --- com.android.support:support-v4:23.0.0 | --- com.android.support:support-annotations:23.0.0 +--- project :android-3.1 +--- project :AVIOCtrlDefine +--- project :Facebook | +--- com.android.support:support-v4:[21,22) -> 23.0.0 () | --- com.parse.bolts:bolts-android:1.1.4 +--- project :SlidingMenu-master +--- com.google.android.gms:play-services:8.4.0 | +--- com.google.android.gms:play-services-ads:8.4.0 () | +--- com.google.android.gms:play-services-analytics:8.4.0 | | --- com.google.android.gms:play-services-basement:8.4.0 () | +--- com.google.android.gms:play-services-appindexing:8.4.0 | | --- com.google.android.gms:play-services-base:8.4.0 | | --- com.google.android.gms:play-services-basement:8.4.0
() | +--- com.google.android.gms:play-services-appinvite:8.4.0 |
| --- com.google.android.gms:play-services-base:8.4.0 () |
+--- com.google.android.gms:play-services-appstate:8.4.0 | | --- com.google.android.gms:play-services-base:8.4.0 () | +--- com.google.android.gms:play-services-auth:8.4.0 | | --- com.google.android.gms:play-services-base:8.4.0 () | +--- com.google.android.gms:play-services-base:8.4.0 () | +--- com.google.android.gms:play-services-basement:8.4.0 () | +--- com.google.android.gms:play-services-cast:8.4.0 | | +--- com.google.android.gms:play-services-base:8.4.0 () | | --- com.android.support:mediarouter-v7:23.0.0 | | --- com.android.support:appcompat-v7:23.0.0 | | --- com.android.support:support-v4:23.0.0 () | +--- com.google.android.gms:play-services-drive:8.4.0 | | --- com.google.android.gms:play-services-base:8.4.0 () | +--- com.google.android.gms:play-services-fitness:8.4.0 | | +--- com.google.android.gms:play-services-base:8.4.0 () | | --- com.google.android.gms:play-services-location:8.4.0 | |
+--- com.google.android.gms:play-services-base:8.4.0 () | | --- com.google.android.gms:play-services-maps:8.4.0 | |
--- com.google.android.gms:play-services-base:8.4.0
() | +--- com.google.android.gms:play-services-games:8.4.0 | | +--- com.google.android.gms:play-services-base:8.4.0 () | | --- com.google.android.gms:play-services-drive:8.4.0 () | +--- com.google.android.gms:play-services-gcm:8.4.0 | | +--- com.google.android.gms:play-services-base:8.4.0 () | | --- com.google.android.gms:play-services-measurement:8.4.0 | |
--- com.google.android.gms:play-services-basement:8.4.0
() | +--- com.google.android.gms:play-services-identity:8.4.0 |
| --- com.google.android.gms:play-services-base:8.4.0 () |
+--- com.google.android.gms:play-services-location:8.4.0 () | +--- com.google.android.gms:play-services-maps:8.4.0 () | +--- com.google.android.gms:play-services-measurement:8.4.0 () | +--- com.google.android.gms:play-services-nearby:8.4.0 | | --- com.google.android.gms:play-services-base:8.4.0 () | +--- com.google.android.gms:play-services-panorama:8.4.0 | | --- com.google.android.gms:play-services-base:8.4.0 () | +--- com.google.android.gms:play-services-plus:8.4.0 | | --- com.google.android.gms:play-services-base:8.4.0 () | +--- com.google.android.gms:play-services-safetynet:8.4.0 | | --- com.google.android.gms:play-services-base:8.4.0 () | +--- com.google.android.gms:play-services-vision:8.4.0 | | --- com.google.android.gms:play-services-base:8.4.0 () | +--- com.google.android.gms:play-services-wallet:8.4.0 | | +--- com.google.android.gms:play-services-base:8.4.0 () | | +--- com.google.android.gms:play-services-identity:8.4.0 () | | --- com.google.android.gms:play-services-maps:8.4.0 () | --- com.google.android.gms:play-services-wearable:8.4.0 | --- com.google.android.gms:play-services-base:8.4.0 () --- com.android.support:multidex:1.0.0
Updated :-
I have tried every thing like adding up of jars one by one , Also Have created one new project in Android studio then put all the folders inside it , have also filter the google play services dependencies which are required for project , have added plugin for google play services too with gcm.jason file in it.
while running ./gradlew assembleDebug --stacktrace command
i am getting :-
Error:trouble processing "java/awt/font/NumericShaper.class": Error:Ill-advised or mistaken usage of a core class (java.* or javax.*)
i have done some search related this error and find that it seems to come because of android.jar replication in project but i have not found any duplicate file in my dependencies .
here is my updated gradle.build file :-
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.petzview.android"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
checkReleaseBuilds false
}
dexOptions {
incremental = true;
maxProcessCount 4
javaMaxHeapSize "4g"
dexInProcess = false
preDexLibraries = false
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-ads:9.0.0'
compile 'com.google.android.gms:play-services-plus:9.0.0'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile project(':AVIOCtrlDefine')
compile project(':Facebook')
compile project(':SlidingMenu-master')
compile 'com.android.support:multidex:1.0.1'
}
android.packagingOptions {
exclude 'the META-INF / DEPENDENCIES'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'the META-INF / LICENSE'
exclude 'the META-INF / LICENSE.txt'
exclude 'the META-INF / license.txt'
exclude 'the META-INF / NOTICE'
exclude 'the META-INF / the NOTICE.txt '
exclude ' the META-INF / NOTICE.txt '
exclude ' the META-INF / ASL2.0 '
exclude ' the META-INF / Services / javax.annotation.processing.Processor '
}
apply plugin: 'com.google.gms.google-services'
Can anybody suggest me a way to solve this problem in android studio.
I`ve got same problem and I fixed it with disabling Instant Run in Android Studio -> Preferences (search for "instant run" or) -> "Build, Execution, Deployment" -> Instant Run -> Enable Instant Run -> turn off Thanks to @Balki for his answer !
try this: (this looks like it might be the problem)
public SVideoFragment() {
super();
}
@SuppressLint({"NewApi","ValidFragment"})
public SVideoFragment(SlidingMenu leftMenu) {
this();
mLeftMenu = leftMenu;
}
for more information: Difference between "this" and"super" keywords in Java
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With